Using Templates/Drafts in Email with Attachments Mac Mail

Hi,
I am trying to create a standard email that to send to new clients once they sign up. This standard email contains attachments and will need a few customizations (e.g.: Name, ad size, start and end dates, etc).
Is there a way to save a draft email that will not disappear once you send it to someone?
I am aware of saving as stationary, but stationary can't be saved with attachments.
In my previous PC/Outlook world, I would create an email with "_____"s in it to remind me to change these fields for the individual recepient (nothing worse than sending a client information that only pertains to the last client you sent it to). I would then simply open that email and click on the "____"s and fill in the info for the individual I'm sending to.
With Mac Mail and Drafts, I can create a template, but once I send it to someone, it deletes the draft. UGH! So frustrating!
Any suggestions are greatly appreciated!

Mail/Mailbox/New Mailbox - select On My Mac to create the Mailbox. Then drag a copy of the draft there before you send the other one.
See last post.
https://discussions.apple.com/message/10182953#10182953

Similar Messages

  • I am using a mac mini (10.8.3) with Mac Mail 6.3 (1503).  Whenever I try to forward an email with attachments, the attachments do not make it.  They show being sent, but the attachments never are sent.

    Hey Guys,
    The title says it all.  Whenever I receive an email with attachments, I will try to forward the email to someone with the attachments.  Mac Mail shows that the attachments are attached, but the receiver says the attachments are not there. Our mail host is Rackspace.  We are setup with IMAP.  It should be noted that we are experiencing similar issues with OS 10.5.8 with Mac Mail 3.6 (936).
    We assumed Rackspace was the problem, so we logged into their webmail portal and tested it and the attachments were received as normal, which points everything back to Mac Mail.  We even had an ISP change but the problem do not change.
    I have researched the problem, and there seems to be evidence of this being a known bug with Mac Mail, but I am hoping there is a workaround.  The company is unwilling to move to a different mail client since they use Daylite 4, which does not support Thunderbird.

    Back up all data.
    1. Triple-click the line below to select it:
    ~/Library/Mail/Bundles
    Right-click or control-click the highlighted line and select
    Services ▹ Open
    from the contextual menu. A folder may open, or you may get an error message that the item can't be found. Either result is normal. If the folder does open and has contents, move the contents to the Desktop. Relaunch Mail and test. If there's no change, put the contents of the folder back and quit Mail again.
    2. Repeat with this line:
    /Library/Mail/Bundles
    This time you may be prompted for your login password when you remove the items. Make sure they're removed from the folder and not just copied to the Desktop. If necessary, copy them first and then move the originals to the Trash.

  • TS1506 I have just got a Mac Book Pro after 30 years of using Msoft products and now find a (in my opinion) a piddling issue with attachments in Mail - Apple - just fix it.

    After over forty years in IT I am actually a platform agnostic however I have come to expect some developmental maturity across all products, especially in generally ubiquitous apps such as email.  I am using OS X 10.8.3 on a 2013 build Mac Book Pro and am very happy overall. Is Apple planning on fixing the various problems with Attachments in Mail or are they relying on third party fixes and workarounds? 

    My apologies if I have caused offence, not my intention.  I was unable to view attachements but have since discovered an addon app which solves the problem very neatly.  By way of explanation my frustration comes from Apple appearing to indulge in client lock in as do Microsoft  - this practice was "invented" by IBM and only served to irritate clients and inspire excellent work arounds by third parties - much the same as I notice with Apple.  I thought Apple would have outgrown this after the IIe vs BBC but I see this is not the case.  I have recently upgraded to Mavericks and have no problems with Mail but am now unable to transfer material from Mac Pro to Ipod unless I use the icloud - something I do not want to do for a variety of reasons, not the least being able to transfer MY data without the use of an unsecured transition area.  I am very happy with the quality of the Mac Pro but less than happy with the restrictive practices of Apple; I realise Microsoft have similar practises but they are not as completely disruptive to what are generally simple operations commonly required when using computers.
    My thanks to all the others who reponded - this is my first foray into the world of forums and I will continue to learn the rules.

  • Mail saving all emails with attachments in "Drafts"

    Since I upgraded to Mavericks (not Maverick or Maverick's...??) Mail has put a copy of every email I send that has an attachment into the "Drafts" folder.  The email has been sent and received by the recipient, and you can find it in the "Sent" folder as well.  Never had this issue before.  I can't find a preference that has any effect on it.
    Any ideas??
    Tks!

    I'm using a PC for my email at the moment. I'm not sure if all my wife's emails have been downloaded. However, Mail has made a Home/Mail/MessageUidsAlreadyDowloaded file. This was created when I sent an email to test what happened. I was unable to make Mail download all her emails, so I guess they must have gone from the server. She has a different email address to mine, but it's run from the same ISP account; as I said, she logs in, automatically, through Mail to her email. I have contacted the ISP about it, but they are unable to see any trace of emails that colleagues have sent my wife and which she sends home to herself. All of these files happen to have attachments, but I cannot see any setting of Mail which would account for them being rejected. Also, I can't be entiurely sure that only emails with attachments don't get through; there may be others, 'unattached'.
    Thanks for your continued assistance.

  • Email with attachments QPAC: setting "From" using process data doesn't work

    Hi,
    I trying to set the "From" in the Email with attachments QPAC from a process variable, let's call it "mailagent", which is of type xs:string.
    So I use a set value QPAC, which sets the "mailagent" variable to "[email protected]". The workflow then continous with the Email QPAC.
    Which stalls and throws the following exception:
    javax.mail.MessagingException: 501 Syntax error, parameters in command "MAIL FROM:<{$/process_data/@mailagent$}>" unrecognized or missing
    Hrm. I thought, I had already used the Email QPAC this way.
    Is there some kind of magic to apply to the Email with attachments QPAC in order for it to accept process data in the "From"?
    Steve

    Yes, I'm sure, it worked for us to. But it obviously no longer does.
    Yes, "mailagent" definitely is a variable of type string, though it's of type
    xs:string. I'm no longer able to create variables, which don't feature the
    xs namespace. Which is quite confusing as I've got absolutely no idea, what the
    xs is used for.
    We are using LiveCycle Workflow 7.2.1, the Email QPAC is 7.0.2. Is this the latest version?
    Steve

  • I often get emails with attachments that will not open with my mac. Is there any free software to help this

    I often get emails with attachments that will not open with my mac often a small ? will show. How do I open these

    What kind of attachment? Post an example file name.

  • How can i secure email with attachments using coldfusion

    Hi,
    I need to send emails with attachments containg word, excel or PDF documents using cfmail. However this email needs to be really secure. How is the best way to secure the entire email with its attachments.
    Any ideas appreciated
    Thanks
    Zubair

    Hi ,
    I hope the following will help you..., using the UTL_SMTP db package.
    DECLARE
    c UTL_SMTP.CONNECTION;
    PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
    BEGIN
    UTL_SMTP.WRITE_DATA(c, name || ': ' || header || UTL_TCP.CRLF);
    END;
    BEGIN
    -- Open connection to SMTP gateway
    c := UTL_SMTP.OPEN_CONNECTION('smtp.server.acme.com');
    UTL_SMTP.HELO(c, 'acme.com');
    UTL_SMTP.MAIL(c, '[email protected]');
    UTL_SMTP.RCPT(c, '[email protected]');
    UTL_SMTP.OPEN_DATA(c);
    send_header('From', '"Oracle Admin" ');
    send_header('To', '"Bob Smith" ');
    send_header('Subject', 'Automated Database Email');
    UTL_SMTP.WRITE_DATA(c, utl_tcp.CRLF || 'This is an automated email from the Oracle database.');
    UTL_SMTP.WRITE_DATA(c, utl_tcp.CRLF || 'The database is working for you!');
    UTL_SMTP.CLOSE_DATA(c);
    UTL_SMTP.QUIT(c);
    END;
    Simon

  • Saving email with attachments together

    I am running leopard on an iMac. I am a recent convert to Mac from the PC, and since I get a lot of emails with attachments, I simply want to save the email and attachment as one entity, as I used to do on my PC. It is very important that I be able to easily know which attachments came with which email. Ideally I would like to retrieve a saved email from a folder, open it, and also see the attachments. Currently, when I try to save an email that contains attachments, I go to File and pull down SAVE AS... A box pops up asking me for the location and it also contains a box at the bottom for me to check if I also want to save the attachments. I check the box, but no attachments are saved. I can go under File and pull down to Save Attachments, and it will save them to wherever I want, but I need the email and attachments together as one unit, for later retrieval. SO CAN ANYONE TELL ME WHAT I AM DOING WRONG HERE ??

    Ok, first your attachments in Leopard Mail are saved in homefolder/library/Mail Downloads, so whatever you do, do not delete attachments in that folder.
    Second, if you have an IMAP account, go to mail>preferences>accounts>advanced... and make sure that for "keep copies of messages for offline viewing" the option "all messages and their attachments" is chosen.
    Third, where are you trying to save these emails, outside of Leopard Mail? I would suggest you save them within Leopard Mail, in mailboxes you will have created for that effect - to create a mailbox go to mailbox>new mailbox, choose the location you want to create the mailbox in as in under your IMAP account, or on your mac, and choose a name for your mailbox. Once that mailbox is created, you can move the emails you want to keep by either selecting the email(s), dragging and dropping in the mailbox you want to keep them, or you can right click and move to, or you can go to message>move to...
    hope this helps.

  • Mail; emails with attachments are not shown in Sent folder

    Since upgrading to Yosemite I have had lots of problems with Mail.
    One is that it seems that some emails with attachments do not show in the Sent folder! Some of them can be found further down, On my Mac in a folder called Recreated letters, or something like that in English.
    Anyone have the same problem?
    Nina

    What is your version of TB? Have you changed anything since the last time it worked? Mail servers changes done by your provider are also possible.
    * Does it occur when an e-mail is sent immediately (before a possible auto-save, see below)?
    * Can you copy any mail from any folder to the Sent folder?
    I've heard of the error "saving to Sent" with older versions of TB, but not related to attachments.
    So, for the general saving to Sent error, some people report that this
    https://kb.wisc.edu/wiscmail/page.php?id=3679
    has helped them.
    I've also heard that turning off "Auto save every .. minutes" in TB preferences > Composition > General has helped some in older versions and IMAP.
    You may check this page: <br>http://kb.mozillazine.org/IMAP:_advanced_account_configuration
    PS: You seem to use Firefox 16, an extremely outdated and insecure browser version. Same for Thunderbird? To be on the safe side (bugs, security), IMHO you should really upgrade regularly to the latest versions, of course backing up your profiles first, especially with TB ( http://kb.mozillazine.org/Profile_backup ).

  • Mail not receiving emails with attachments

    Hi
    I'd appreciate any suggestions in relation to the following.
    My wife and I both run computers from the one account, Mail on her PowerBook logging in through my name and password. Until recently, we have had no problems at all. However, it has come to light that my wife has not been receiving emails with attachments for some time. To test this, my wife sent an email with an attachment to her home email address from work, and copied it to me. I received the email and the attachment on my PC; my wife's Mac did not receive the email. I then forwarded the email with the attachment to her computer; this was successful. This would suggest some problem with her Mail account on the Mac. However, the configuration has not been changed. Is it possible for it just to stop working for some reason?

    I'm using a PC for my email at the moment. I'm not sure if all my wife's emails have been downloaded. However, Mail has made a Home/Mail/MessageUidsAlreadyDowloaded file. This was created when I sent an email to test what happened. I was unable to make Mail download all her emails, so I guess they must have gone from the server. She has a different email address to mine, but it's run from the same ISP account; as I said, she logs in, automatically, through Mail to her email. I have contacted the ISP about it, but they are unable to see any trace of emails that colleagues have sent my wife and which she sends home to herself. All of these files happen to have attachments, but I cannot see any setting of Mail which would account for them being rejected. Also, I can't be entiurely sure that only emails with attachments don't get through; there may be others, 'unattached'.
    Thanks for your continued assistance.

  • Hi, i am having trouble with my mac mail account, i cannot send or receive any emails because of the server connection problems. Message says it could not be connected to SMTP server. Thanks in advance for your help.

    Hi, i am having trouble with my mac mail account, i cannot send or receive any emails because of the server connection problems. Message says it could not be connected to SMTP server. Thanks in advance for your help.

    Hello Sue,
    I have an iPad 3, iPad Mini and iPhone 5S and they are all sluggish on capitalisation using shift keys. I hope that Apple will solve the problem because it is driving me crazy.
    I find using a Microsoft Surface and Windows 8 phone, which I also have, work as well as all the ios devices before the ios 7 upgrade.
    It has something to do with the length of time that you need to hold the shift key down. The shift key needs to be held longer than the letter key for the capitalisation to work. For some reason, this is a major change in the way we have learnt to touch type on computers. I am having to relearn how to type!
    Michael

  • Can not view (some) emails with attachments

    There has already been some discussion about individuals getting the "This message has not been downloaded from the server" error.
    http://discussions.apple.com/message.jspa?messageID=4983643
    Has anyone found a solution to this problem? I am using GMail and am having problems reading (some) emails with attachments. I can read the first several lines through the preview view, but can not open (some) emails without getting the "This message has not been downloaded from the server" error.
    The problem appears to be completely random. The problem occurs sometimes after I open the email on my computer, and other times it occurs before I open the email on my computer. And sometimes opening the email on my computer does not cause any problem opening the email on my phone.
    I have seen this problem on two different phones now and have re-created the email accounts on both phone several times. But the problems keeps (eventually) appearing--for some, but not all emails.
     PowerBook G4, Macintosh 512K     iPod nano (2nd Gen 8GB), iPhone (8GB)

    So, I think things are actually sending/downloading and it's just taking time and the iphone is defaulting to the error message.
    I don't think that's the case. I have several week-old messages on my iPhone (each under 300k) that still say "The message has not been downloaded from the server."
    I've been connected to wifi for over an hour now, so that's plenty of time to downloaded these few small emails. I can read the "preview" of the message from the Inbox screen, but when I click on the message itself, I get the error.
    And, those messages with the attachments that I was able to open this morning? I can no longer open them now. Very, very frustrating.

  • Fetching email with attachments in Tomcat

    I'm trying to process emails with attachments using following code and it works fine in standalone java application, but when I run this code on Tomcat it treates all messages as not multipart. Class of all contents got from messages is SharedByteArrayInputStream.
    I'm using jdk1.6.0_27 and javamail1_4_5
    I put mail.jar in WEB-INF/lib of my war.
    Can anyone help my how to deal with this? What's wrong?
    package test;
    import java.util.Arrays;
    import java.util.List;
    import java.util.Properties;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Session;
    import javax.mail.Store;
    public class Main {
    private static Store store;
    private static Folder folder;
    * @param args
    * @throws Exception
    public static void main(String[] args) throws Exception {
    try {
    List<Message> messages = getMessages("...", "...", "...");
    for (Message mess : messages) {
    System.out.println(mess.getSentDate());
    Object content = mess.getContent();
    if (content instanceof Multipart) {
    System.out.println("miltipart");
    } else {
    System.out.println("plain");
    } finally {
    close();
    public static List<Message> getMessages(String host, String userName, String password) throws Exception {
    if (store != null || folder != null) {
    throw new IllegalStateException("There are open and closed messages exist");
    // create empty properties
    Properties props = new Properties();
    // get session
    Session session = Session.getDefaultInstance(props, null);
    try {
    // get the store
    store = session.getStore("pop3");
    store.connect(host, userName, password);
    // get folder
    folder = store.getFolder("INBOX");
    folder.open(Folder.READ_ONLY);
    // get directory
    return Arrays.asList(folder.getMessages());
    } catch (MessagingException e) {
    throw new Exception("Exception while mail receiving ", e);
    public static void close() throws MessagingException {
    // close connection
    if (folder != null) {
    folder.close(false);
    if (store != null) {
    store.close();
    folder = null;
    store = null;
    }

    But I found another interesting issue.
    When I run my application everything works fine on first iteration. According to my code I get default instance of Session, get Store, get Folder and at last getMessages. After processing messages I close folder and store.
    But if I don't restart my application and try to get messages again all of the SAME messages became plain (SharedByteArrayInputStream) again (as it was earlier).
    If I restart my application first iteration works fine and others fails.
    In both iterations used the same instance of class where I put Thread.currentThread().setContextClassLoader(BaseEmailService.class.getClassLoader());
    What I must reinitialize to make it works on each iteration?

  • Auto display HTML attachments in body / email sent from mac mail

    Hi,
    One of my clients has received an email written in MAC Mail, the email doesn't display correctly instead what would be the body of the email appears as an html attachment, he doesn't want to have to click the attachment to preview it as he doesn't have to
    do this on the iphone (also an apple device hmm....), I cant see any way of making it auto display the html in the body without clicking it.
    Does anyone have any ideas?

    Hi,
    Can you confirm if the sender has this problem sending emails to other recipients?
    Please logon your Webmail(or OWA), does that message display as an attachment as well?
    If other Outlook recipients also see the email body as an attachment and you can verify it shows as an attachment on Web as well, I'm afraid we should blame the Apple Mail Client, since I've seen some Apple Mail users have this problem:
    https://discussions.apple.com/thread/1947994?tstart=0
    Kindly have the sender check if the setting like Edit > Attachments > Send Windows friendly Attachments
    has been checked.
    If I'm not getting this wrong, we should confirm this issue with Apple:
    https://discussions.apple.com/index.jspa
    Feel free to post back of course.
    Regards,
    Melon Chen
    TechNet Community Support

  • How to send Email with attachments

    Hi im Trying to send a file as attachment using EMail Activity operator.
    Can we do it using Email activity? If yes, then how can we do it? If no, then please tell me about any other method using which i can send a email with attachments.
    Regards
    Vibhuti

    Better late than never, a comprehensive demo on the topic:
    REM
    REM maildemo.sql - A PL/SQL package to demonstrate how to use the UTL_SMTP
    REM package to send emails in ASCII and non-ASCII character sets, emails
    REM with text or binary attachments.
    REM
    REM Note: this package relies on the UTL_ENCODE PL/SQL package in Oracle 9i.
    CREATE OR REPLACE PACKAGE demo_mail IS
      ----------------------- Customizable Section -----------------------
      -- Customize the SMTP host, port and your domain name below.
      smtp_host   VARCHAR2(256) := 'smtp-server.some-company.com';
      smtp_port   PLS_INTEGER   := 25;
      smtp_domain VARCHAR2(256) := 'some-company.com';
      -- Customize the signature that will appear in the email's MIME header.
      -- Useful for versioning.
      MAILER_ID   CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
      --------------------- End Customizable Section ---------------------
      -- A unique string that demarcates boundaries of parts in a multi-part email
      -- The string should not appear inside the body of any part of the email.
      -- Customize this if needed or generate this randomly dynamically.
      BOUNDARY        CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
      FIRST_BOUNDARY  CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
      LAST_BOUNDARY   CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
                                                  utl_tcp.CRLF;
      -- A MIME type that denotes multi-part email (MIME) messages.
      MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
                                                      BOUNDARY || '"';
      MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER   := 76 / 4 * 3;
      -- A simple email API for sending email in plain text in a single call.
      -- The format of an email address is one of these:
      --   someone@some-domain
      --   "Someone at some domain" <someone@some-domain>
      --   Someone at some domain <someone@some-domain>
      -- The recipients is a list of email addresses  separated by
      -- either a "," or a ";"
      PROCEDURE mail(sender     IN VARCHAR2,
               recipients IN VARCHAR2,
               subject    IN VARCHAR2,
               message    IN VARCHAR2);
      -- Extended email API to send email in HTML or plain text with no size limit.
      -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
      -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
      -- email in non-ASCII or multi-byte character set. End the email with
      -- end_mail().
      FUNCTION begin_mail(sender     IN VARCHAR2,
                    recipients IN VARCHAR2,
                    subject    IN VARCHAR2,
                    mime_type  IN VARCHAR2    DEFAULT 'text/plain',
                    priority   IN PLS_INTEGER DEFAULT NULL)
                    RETURN utl_smtp.connection;
      -- Write email body in ASCII
      PROCEDURE write_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN VARCHAR2);
      -- Write email body in non-ASCII (including multi-byte). The email body
      -- will be sent in the database character set.
      PROCEDURE write_mb_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN            VARCHAR2);
      -- Write email body in binary
      PROCEDURE write_raw(conn    IN OUT NOCOPY utl_smtp.connection,
                    message IN RAW);
      -- APIs to send email with attachments. Attachments are sent by sending
      -- emails in "multipart/mixed" MIME format. Specify that MIME format when
      -- beginning an email with begin_mail().
      -- Send a single text attachment.
      PROCEDURE attach_text(conn         IN OUT NOCOPY utl_smtp.connection,
                   data         IN VARCHAR2,
                   mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                   inline       IN BOOLEAN  DEFAULT TRUE,
                   filename     IN VARCHAR2 DEFAULT NULL,
                      last         IN BOOLEAN  DEFAULT FALSE);
      -- Send a binary attachment. The attachment will be encoded in Base-64
      -- encoding format.
      PROCEDURE attach_base64(conn         IN OUT NOCOPY utl_smtp.connection,
                     data         IN RAW,
                     mime_type    IN VARCHAR2 DEFAULT 'application/octet',
                     inline       IN BOOLEAN  DEFAULT TRUE,
                     filename     IN VARCHAR2 DEFAULT NULL,
                     last         IN BOOLEAN  DEFAULT FALSE);
      -- Send an attachment with no size limit. First, begin the attachment
      -- with begin_attachment(). Then, call write_text repeatedly to send
      -- the attachment piece-by-piece. If the attachment is text-based but
      -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
      -- To send binary attachment, the binary content should first be
      -- encoded in Base-64 encoding format using the demo package for 8i,
      -- or the native one in 9i. End the attachment with end_attachment.
      PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                        mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                        inline       IN BOOLEAN  DEFAULT TRUE,
                        filename     IN VARCHAR2 DEFAULT NULL,
                        transfer_enc IN VARCHAR2 DEFAULT NULL);
      -- End the attachment.
      PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                      last IN BOOLEAN DEFAULT FALSE);
      -- End the email.
      PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
      -- Extended email API to send multiple emails in a session for better
      -- performance. First, begin an email session with begin_session.
      -- Then, begin each email with a session by calling begin_mail_in_session
      -- instead of begin_mail. End the email with end_mail_in_session instead
      -- of end_mail. End the email session by end_session.
      FUNCTION begin_session RETURN utl_smtp.connection;
      -- Begin an email in a session.
      PROCEDURE begin_mail_in_session(conn       IN OUT NOCOPY utl_smtp.connection,
                          sender     IN VARCHAR2,
                          recipients IN VARCHAR2,
                          subject    IN VARCHAR2,
                          mime_type  IN VARCHAR2  DEFAULT 'text/plain',
                          priority   IN PLS_INTEGER DEFAULT NULL);
      -- End an email in a session.
      PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
      -- End an email session.
      PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;
    CREATE OR REPLACE PACKAGE BODY demo_mail IS
      -- Return the next email address in the list of email addresses, separated
      -- by either a "," or a ";".  The format of mailbox may be in one of these:
      --   someone@some-domain
      --   "Someone at some domain" <someone@some-domain>
      --   Someone at some domain <someone@some-domain>
      FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
        addr VARCHAR2(256);
        i    pls_integer;
        FUNCTION lookup_unquoted_char(str  IN VARCHAR2,
                          chrs IN VARCHAR2) RETURN pls_integer AS
          c            VARCHAR2(5);
          i            pls_integer;
          len          pls_integer;
          inside_quote BOOLEAN;
        BEGIN
           inside_quote := false;
           i := 1;
           len := length(str);
           WHILE (i <= len) LOOP
          c := substr(str, i, 1);
          IF (inside_quote) THEN
            IF (c = '"') THEN
              inside_quote := false;
            ELSIF (c = '\') THEN
              i := i + 1; -- Skip the quote character
            END IF;
            GOTO next_char;
          END IF;
          IF (c = '"') THEN
            inside_quote := true;
            GOTO next_char;
          END IF;
          IF (instr(chrs, c) >= 1) THEN
             RETURN i;
          END IF;
          <<next_char>>
          i := i + 1;
           END LOOP;
           RETURN 0;
        END;
      BEGIN
        addr_list := ltrim(addr_list);
        i := lookup_unquoted_char(addr_list, ',;');
        IF (i >= 1) THEN
          addr      := substr(addr_list, 1, i - 1);
          addr_list := substr(addr_list, i + 1);
        ELSE
          addr := addr_list;
          addr_list := '';
        END IF;
        i := lookup_unquoted_char(addr, '<');
        IF (i >= 1) THEN
          addr := substr(addr, i + 1);
          i := instr(addr, '>');
          IF (i >= 1) THEN
         addr := substr(addr, 1, i - 1);
          END IF;
        END IF;
        RETURN addr;
      END;
      -- Write a MIME header
      PROCEDURE write_mime_header(conn  IN OUT NOCOPY utl_smtp.connection,
                         name  IN VARCHAR2,
                         value IN VARCHAR2) IS
      BEGIN
        utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
      END;
      -- Mark a message-part boundary.  Set <last> to TRUE for the last boundary.
      PROCEDURE write_boundary(conn  IN OUT NOCOPY utl_smtp.connection,
                      last  IN            BOOLEAN DEFAULT FALSE) AS
      BEGIN
        IF (last) THEN
          utl_smtp.write_data(conn, LAST_BOUNDARY);
        ELSE
          utl_smtp.write_data(conn, FIRST_BOUNDARY);
        END IF;
      END;
      PROCEDURE mail(sender     IN VARCHAR2,
               recipients IN VARCHAR2,
               subject    IN VARCHAR2,
               message    IN VARCHAR2) IS
        conn utl_smtp.connection;
      BEGIN
        conn := begin_mail(sender, recipients, subject);
        write_text(conn, message);
        end_mail(conn);
      END;
      FUNCTION begin_mail(sender     IN VARCHAR2,
                    recipients IN VARCHAR2,
                    subject    IN VARCHAR2,
                    mime_type  IN VARCHAR2    DEFAULT 'text/plain',
                    priority   IN PLS_INTEGER DEFAULT NULL)
                    RETURN utl_smtp.connection IS
        conn utl_smtp.connection;
      BEGIN
        conn := begin_session;
        begin_mail_in_session(conn, sender, recipients, subject, mime_type,
          priority);
        RETURN conn;
      END;
      PROCEDURE write_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN VARCHAR2) IS
      BEGIN
        utl_smtp.write_data(conn, message);
      END;
      PROCEDURE write_mb_text(conn    IN OUT NOCOPY utl_smtp.connection,
                     message IN            VARCHAR2) IS
      BEGIN
        utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
      END;
      PROCEDURE write_raw(conn    IN OUT NOCOPY utl_smtp.connection,
                    message IN RAW) IS
      BEGIN
        utl_smtp.write_raw_data(conn, message);
      END;
      PROCEDURE attach_text(conn         IN OUT NOCOPY utl_smtp.connection,
                   data         IN VARCHAR2,
                   mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                   inline       IN BOOLEAN  DEFAULT TRUE,
                   filename     IN VARCHAR2 DEFAULT NULL,
                      last         IN BOOLEAN  DEFAULT FALSE) IS
      BEGIN
        begin_attachment(conn, mime_type, inline, filename);
        write_text(conn, data);
        end_attachment(conn, last);
      END;
      PROCEDURE attach_base64(conn         IN OUT NOCOPY utl_smtp.connection,
                     data         IN RAW,
                     mime_type    IN VARCHAR2 DEFAULT 'application/octet',
                     inline       IN BOOLEAN  DEFAULT TRUE,
                     filename     IN VARCHAR2 DEFAULT NULL,
                     last         IN BOOLEAN  DEFAULT FALSE) IS
        i   PLS_INTEGER;
        len PLS_INTEGER;
      BEGIN
        begin_attachment(conn, mime_type, inline, filename, 'base64');
        -- Split the Base64-encoded attachment into multiple lines
        i   := 1;
        len := utl_raw.length(data);
        WHILE (i < len) LOOP
           IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
          utl_smtp.write_raw_data(conn,
             utl_encode.base64_encode(utl_raw.substr(data, i,
             MAX_BASE64_LINE_WIDTH)));
           ELSE
          utl_smtp.write_raw_data(conn,
            utl_encode.base64_encode(utl_raw.substr(data, i)));
           END IF;
           utl_smtp.write_data(conn, utl_tcp.CRLF);
           i := i + MAX_BASE64_LINE_WIDTH;
        END LOOP;
        end_attachment(conn, last);
      END;
      PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                        mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                        inline       IN BOOLEAN  DEFAULT TRUE,
                        filename     IN VARCHAR2 DEFAULT NULL,
                        transfer_enc IN VARCHAR2 DEFAULT NULL) IS
      BEGIN
        write_boundary(conn);
        write_mime_header(conn, 'Content-Type', mime_type);
        IF (filename IS NOT NULL) THEN
           IF (inline) THEN
           write_mime_header(conn, 'Content-Disposition',
             'inline; filename="'||filename||'"');
           ELSE
           write_mime_header(conn, 'Content-Disposition',
             'attachment; filename="'||filename||'"');
           END IF;
        END IF;
        IF (transfer_enc IS NOT NULL) THEN
          write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
        END IF;
        utl_smtp.write_data(conn, utl_tcp.CRLF);
      END;
      PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                      last IN BOOLEAN DEFAULT FALSE) IS
      BEGIN
        utl_smtp.write_data(conn, utl_tcp.CRLF);
        IF (last) THEN
          write_boundary(conn, last);
        END IF;
      END;
      PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
      BEGIN
        end_mail_in_session(conn);
        end_session(conn);
      END;
      FUNCTION begin_session RETURN utl_smtp.connection IS
        conn utl_smtp.connection;
      BEGIN
        -- open SMTP connection
        conn := utl_smtp.open_connection(smtp_host, smtp_port);
        utl_smtp.helo(conn, smtp_domain);
        RETURN conn;
      END;
      PROCEDURE begin_mail_in_session(conn       IN OUT NOCOPY utl_smtp.connection,
                          sender     IN VARCHAR2,
                          recipients IN VARCHAR2,
                          subject    IN VARCHAR2,
                          mime_type  IN VARCHAR2  DEFAULT 'text/plain',
                          priority   IN PLS_INTEGER DEFAULT NULL) IS
        my_recipients VARCHAR2(32767) := recipients;
        my_sender     VARCHAR2(32767) := sender;
      BEGIN
        -- Specify sender's address (our server allows bogus address
        -- as long as it is a full email address ([email protected]).
        utl_smtp.mail(conn, get_address(my_sender));
        -- Specify recipient(s) of the email.
        WHILE (my_recipients IS NOT NULL) LOOP
          utl_smtp.rcpt(conn, get_address(my_recipients));
        END LOOP;
        -- Start body of email
        utl_smtp.open_data(conn);
        -- Set "From" MIME header
        write_mime_header(conn, 'From', sender);
        -- Set "To" MIME header
        write_mime_header(conn, 'To', recipients);
        -- Set "Subject" MIME header
        write_mime_header(conn, 'Subject', subject);
        -- Set "Content-Type" MIME header
        write_mime_header(conn, 'Content-Type', mime_type);
        -- Set "X-Mailer" MIME header
        write_mime_header(conn, 'X-Mailer', MAILER_ID);
        -- Set priority:
        --   High      Normal       Low
        --   1     2     3     4     5
        IF (priority IS NOT NULL) THEN
          write_mime_header(conn, 'X-Priority', priority);
        END IF;
        -- Send an empty line to denotes end of MIME headers and
        -- beginning of message body.
        utl_smtp.write_data(conn, utl_tcp.CRLF);
        IF (mime_type LIKE 'multipart/mixed%') THEN
          write_text(conn, 'This is a multi-part message in MIME format.' ||
         utl_tcp.crlf);
        END IF;
      END;
      PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
      BEGIN
        utl_smtp.close_data(conn);
      END;
      PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
      BEGIN
        utl_smtp.quit(conn);
      END;
    END;
    /

Maybe you are looking for

  • Deleting a row from a Procedure

    Hi All Can one of you tell me how to delete a row from a Procedure It is created with CREATE OR REPLACE PROCEDURE report.NAMEOFTABLE (nPutId IN Report.ID%TYPE, cArea IN Report.Area%TYPE, cSubject IN Report.Subject%TYPE, nUserId IN Report.EngineerID%T

  • Printing problems with my newest Mac: can't connect to networked LaserJet

    I have several Macs printing to an HP LaserJet 4000TN on my LAN. All but one work fine. Even the Windows machine works. The bad actor is a new MacBook Pro. When I try to set the printer up (using the HP JetDirect IP connection), for some reason it ca

  • Connection Management Error in Biller Direct Application

    Hi Experts, We are in the process of implementing Biller Direct Solution for the Suppliers/Vendor! All the XCM Settings , Backend Settings , Portal Settings have been in place and we were able to run the application without any difficulties but all o

  • AL & Glassfish Production system on CentOS?

    I'm seeking opinions and REAL EXPERIENCE from anyone running the apex listener with glassfish on the CentOS linux OS.  I realize Oracle does not officially support CentOS (at least it isn't listed as an OS option on the glassfish site nor My Oracle S

  • X11 Language input.

    I'm using an X11 application and would like to input text as Chinese, Japanese & Korean characters. I've got the option "Use the system keyboard layout" checked but I can't input asian languages. I'm on a US keyboard but have the asian fonts installe