Sending an HTML email with Automator

I am trying to send a HTML postcard that I created to a list of 200 friends for a golf tournament. I would like to use Automator to send the emails to each user individually and not to the entire group at once.
So far I found one Automator action that will create an email message from a Safari page but my trouble is entering the addresses from my address book group for all 200 emails.
Could someone help me with a workflow?
Thanks in advance,
Adam

Try this
<%@ page import="sun.net.smtp.SmtpClient,java.io.PrintStream" %>
<%
try{
String host = "IP"; //this is u r IP adress
String from = "[email protected]"; //mail adress of sender
String to = "[email protected]"; //mail address whom to
SmtpClient smtp = new SmtpClient(host);
smtp.from(from);
smtp.to(to);
PrintStream out1 = smtp.startMessage();
out1.println("To: " + to);
out1.println("Subject: Hello peter ");
out1.println();
out1.println("Hi Peter How r u doing ");
out1.flush();
out1.close();
smtp.closeServer();
catch(Exception e)
out.println(e+e.getMessage());
%>

Similar Messages

  • Sending a html email with jsp

    is it possible to send an email with html content and how do i do that

    Try this
    <%@ page import="sun.net.smtp.SmtpClient,java.io.PrintStream" %>
    <%
    try{
    String host = "IP"; //this is u r IP adress
    String from = "[email protected]"; //mail adress of sender
    String to = "[email protected]"; //mail address whom to
    SmtpClient smtp = new SmtpClient(host);
    smtp.from(from);
    smtp.to(to);
    PrintStream out1 = smtp.startMessage();
    out1.println("To: " + to);
    out1.println("Subject: Hello peter ");
    out1.println();
    out1.println("Hi Peter How r u doing ");
    out1.flush();
    out1.close();
    smtp.closeServer();
    catch(Exception e)
    out.println(e+e.getMessage());
    %>

  • HTML emails with attachments

    When I compose an html email (ie: using the float left alignment on a picture) and add an attachment(word doc), the formatting is lost on the recipient's end. In fact usually, the body of the message is blank and the pictures, html file, and original attachment all show up as attachments. I'm wondering if this is an undocumented limitation of Mail or if I'm doing something wrong. I know that when you compose a mail using stationery you can't add any attachments.
    The formatting isn't even correct in Mail's sent folder (show up as rich text similar to Mail 2's formatting). Is anyone out there able to send an html email with an attachment?
    ~Ryan

    It looks like there is an actual RFC for HTML e-mail. It is a bit more "standard" than I thought. When I looked at the raw messages last night, they didn't look like other HTML MIME messages I had worked with in the past. If I can provide that Apple Mail doesn't conform to this RFC, I will update the bug report with the details. In the past, Apple has been very good with e-mail standards - years ahead of everyone else. I certainly hope the format of the message is correct and it is just a display problem.

  • Sending HTML email with SO_DOCUMENT_SEND_API1

    Hi all,
    I have implemented a function module to send HTML emails with SO_DOCUMENT_SEND_API1.
    It works fine, but in every email I have at the end a CRLF which looks not very nice in MS Outlook.
    It seems that this will be added to every email in addition to my HTML text.
    Has anyone an idea how I can prevent this?
    Thanks in advance for your help.
    Best Regards,
    Marcel

    Hi Marcel,
    not only you can, you should use CL_BCS for sending of email. Although I expect it to be not too different from the old functions, it points to the object oriented future of SAP/ABAP. At least it should run more stable and SAP recommends to use it as a replacement for old functions.
    I came across one blog
    [Sending HTML Email from SAP CRM/ERP|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/2273]
    You may be careful with this one: Probably it's not exactly what you need.
    The one I love most for its simplicity is this one
    [Unknown thus unloved?|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/3443]
    although it does not mention HTML - I think easy for you to adapt. Compared  to functional SO_DOCUMENT.. approach the program will shrink.
    If you want to understand the concepts behind, nobody explains it better than
    [Thomas Jung: Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/789]
    or - if you still feel unsafe in oo environment -
    [Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/15408]
    Happy coding!
    Regards,
    Clemens

  • UTL_SMTP send HTML email with embedded image?

    Hi, I can use UTL_SMTP to send an HTML email ok, but does anyone have an example of how to include an inline embedded image in the email? Thanks!

    If you want to send the html page and have it
    reference the images and css files on your web
    site, that's pretty easy. Just create a message
    with text/html content that is your html page.
    If you want to include all the images and css files
    in your message along with the html page, you'll
    need to create a multipart/related message and
    you'll need to change all the html to reference the
    images and css files using "cid:" references.

  • Send HTML emails with ODI

    Hi,
    I wish to send HTML emails with ODI but it seems not possible with the tool ODISendMail. Do you know a procedure to do it ?
    Thank you very much for your answers.
    Regards.

    Hello,
    Thanks but this article decribes an other tool that I don't have in my version. Maybe is it possible to send me the procedure XML to import it ?
    There is also a procedure available on the Oracle support (TRT_Send_Jython_HTML_Email.xml) but I don't know where I can download it... Do you ?
    Thank you very much

  • HOW TO SEND A HEBREW EMAIL WITH ATTACHMENT USING DEMO_MAIL

    Hello All,
    This is Not a question , just attaching something I've implemented and might be interesting for few of us,
    This package I'm attaching allows to send Hebrew Language email + attaching files to it.
    This package is based on demo_mail package (combined here but you can search at google for more example information if needed).
    My Package is supplied as is , for any specific information regarding it , please contact me directly at : [email protected] or POST here.
    * Please also note , that this package allow file to be attach via URL (meaning you will have to define a link to this file, if you would like to implement a link to a local file , e.g : c:\temp\myfile , you will have to customize the package your self with database directories option etc ...)
    First I will attach an example of how to use it :
    ==================================
    begin
    demo_mail_heb.send_html_mail_attach(p_sender => '[email protected]',
    p_recipients => '[email protected]',
    p_subject => 'שלום וברכה עולם',
    p_data => '<hr><b>בוקר טוב</b><hr>',
    p_file_name => 'but_choose_file.gif',
    p_file_mime_type => 'application/pdf',
    p_file_URL => 'http://10.172.246.160:7777/i/but_choose_file.gif');
    end;
    Second Here is the Package (please note you will have to modify few settings in order to enable it , such as mail server address ..etc)
    ======================================================================================
    CREATE OR REPLACE PACKAGE demo_mail_heb IS
    ----------------------- Customizable Section -----------------------
    -- Customize the SMTP host, port and your domain name below.
    smtp_host VARCHAR2(256) := 'mail.oracle.com';
    smtp_port PLS_INTEGER := 25;
    smtp_domain VARCHAR2(256) := 'oracle.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;
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255');
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default demo_mail_heb.MULTIPART_MIME_TYPE,
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif');
    -- 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; charset=windows-1255',
              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_heb IS
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255')
    Is
    conn utl_smtp.connection;
    BEGIN
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => p_mime_type);
    demo_mail_heb.write_text(
    conn => conn,
    message => p_data);
    demo_mail_heb.end_mail( conn => conn );
    END;
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default demo_mail_heb.MULTIPART_MIME_TYPE,
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif')
    is
    conn utl_smtp.connection;
    req utl_http.req;
    resp utl_http.resp;
    data RAW(200);
    begin
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => p_mime_type);
    demo_mail_heb.attach_text(
    conn => conn,
    data => p_data,
    mime_type => 'text/html');
    demo_mail_heb.begin_attachment(
    conn => conn,
    mime_type => p_file_mime_type,
    inline => TRUE,
    filename => p_file_name,
    transfer_enc => 'base64');
    -- In writing Base-64 encoded text following the MIME format below,
    -- the MIME format requires that a long piece of data must be splitted
    -- into multiple lines and each line of encoded data cannot exceed
    -- 80 characters, including the new-line characters. Also, when
    -- splitting the original data into pieces, the length of each chunk
    -- of data before encoding must be a multiple of 3, except for the
    -- last chunk. The constant demo_mail_heb.MAX_BASE64_LINE_WIDTH
    -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
    -- of data before encoding.
    Utl_Http.set_proxy('www-proxy.us.oracle.com', 'oracle.com');
    req := utl_http.begin_request(p_file_URL);
    resp := utl_http.get_response(req);
    BEGIN
    LOOP
    utl_http.read_raw(resp, data, demo_mail_heb.MAX_BASE64_LINE_WIDTH);
    demo_mail_heb.write_raw(
    conn => conn,
    message => utl_encode.base64_encode(data));
    END LOOP;
    EXCEPTION
    WHEN utl_http.end_of_body THEN
    utl_http.end_response(resp);
    END;
    demo_mail_heb.end_attachment( conn => conn );
    demo_mail_heb.end_mail( conn => conn );
    end;
    -- 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);
    utl_smtp.write_raw_data(conn, UTL_RAW.CAST_TO_RAW(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_raw_data(conn, utl_raw.cast_to_raw(CONVERT(message,'IW8ISO8859P8')));
    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',
                   --     mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
                        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;

    Hello All,
    Small modification - use this package and not the above
    HERE IS A WORKING CODE FOR SENDING HEBREW MESSAGES (INCLUDING SUBJECT IN UTF-8 APPEAR IN ALL EMAIL CLIENTS I HAVE CHECKED) + ATTACHMENTS
    Code attached below is supplied as is with no support. anyhow if help is needed , please contact me via [email protected]
    ============================================================================
    CREATE OR REPLACE PACKAGE demo_mail_heb IS
    ----------------------- Customizable Section -----------------------
    -- Customize the SMTP host, port and your domain name below.
    smtp_host VARCHAR2(256) := pst_ajax.getParameter('EMAIL_SMTP_HOST');
    smtp_port PLS_INTEGER := pst_ajax.getParameter('EMAIL_SMTP_PORT');
    smtp_domain VARCHAR2(256) := pst_ajax.getParameter('EMAIL_SMTP_DOMAIN');
    -- 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;
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255');
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default 'text/html; charset=windows-1255',
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif');
    -- 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;
    -- Handling the Email Subject Line
    function mimeheader_encode(
    p_str varchar2
    , p_charset varchar2 := 'UTF-8') return varchar2;
    -- 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; charset=windows-1255',
              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_heb IS
    -- Sent clear Html Email
    procedure send_html_mail (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default null,
    p_mime_type in varchar2 default 'text/html; charset=windows-1255')
    Is
    conn utl_smtp.connection;
    BEGIN
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => 'text/html; charset=UTF-8');--p_mime_type);
    demo_mail_heb.write_text(
    conn => conn,
    message => p_data);
    demo_mail_heb.end_mail( conn => conn );
    END;
    -- Sent Html Email with Attachment
    procedure send_html_mail_attach (p_sender in varchar2 default null,
    p_recipients in varchar2 default null,
    p_subject in varchar2 default null,
    p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
    p_mime_type in varchar2 default 'text/html; charset=windows-1255',
    p_file_name in varchar2 default 'but_choose_file.gif',
    p_file_mime_type in varchar2 default 'application/pdf',
    p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif')
    is
    conn utl_smtp.connection;
    req utl_http.req;
    resp utl_http.resp;
    data RAW(200);
    v_mime_type varchar2(32767):=demo_mail.MULTIPART_MIME_TYPE;
    begin
    conn := demo_mail_heb.begin_mail(
    sender => p_sender,
    recipients => p_recipients,
    subject => p_subject,
    mime_type => v_mime_type);
    demo_mail_heb.attach_text(
    conn => conn,
    data => p_data,
    mime_type => 'text/html');
    demo_mail_heb.begin_attachment(
    conn => conn,
    mime_type => p_file_mime_type,
    inline => TRUE,
    filename => p_file_name,
    transfer_enc => 'base64');
    -- In writing Base-64 encoded text following the MIME format below,
    -- the MIME format requires that a long piece of data must be splitted
    -- into multiple lines and each line of encoded data cannot exceed
    -- 80 characters, including the new-line characters. Also, when
    -- splitting the original data into pieces, the length of each chunk
    -- of data before encoding must be a multiple of 3, except for the
    -- last chunk. The constant demo_mail_heb.MAX_BASE64_LINE_WIDTH
    -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
    -- of data before encoding.
    req := utl_http.begin_request(p_file_URL);
    resp := utl_http.get_response(req);
    BEGIN
    LOOP
    utl_http.read_raw(resp, data, demo_mail_heb.MAX_BASE64_LINE_WIDTH);
    demo_mail_heb.write_raw(
    conn => conn,
    message => utl_encode.base64_encode(data));
    END LOOP;
    EXCEPTION
    WHEN utl_http.end_of_body THEN
    utl_http.end_response(resp);
    END;
    demo_mail_heb.end_attachment( conn => conn );
    demo_mail_heb.end_mail( conn => conn );
    end;
    -- 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);
    utl_smtp.write_raw_data(conn, UTL_RAW.CAST_TO_RAW(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_raw_data(conn, utl_raw.cast_to_raw(CONVERT(message,'IW8ISO8859P8')));
    -- utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(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;
    -- Handling the Email Subject Line
    function mimeheader_encode(
    p_str varchar2
    , p_charset varchar2 := 'UTF-8') return varchar2 is
    l_str varchar2(2000);
    begin
    l_str:=utl_raw.cast_to_varchar2(utl_encode.quoted_printable_encode(utl_raw.cast_to_raw(p_str)));
    l_str:=replace(l_str,'='||chr(13)||chr(10),''); --unfold the data
    l_str:=replace(l_str,'?','=3f'); --quote question marks
    l_str:=replace(l_str,' ','=20'); --quote spaces
    l_str:='=?'||p_charset||'?Q?'||l_str||'?='; -- add prefix and suffix
    return l_str;
    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',
    -- mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
    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 "Content-Type" MIME header
    write_mime_header(conn, 'Content-Type', mime_type);
    -- write_mime_header(conn, 'Content-Type', 'text/html; charset=UTF-8');
    -- Set "Subject" MIME header
    -- write_mime_header(conn, 'Subject', subject);
    -- write_mime_header(conn, 'Subject', CONVERT(subject,'IW8ISO8859P8'));
    write_mime_header(conn, 'Subject',mimeheader_encode(p_str => subject,p_charset => 'UTF-8'));
    -- write_mime_header(conn, 'Subject',CONVERT(subject,'IW8MSWIN1255'));
    -- 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;

  • When I forward an HTML email with embedded graphics to someone, it forwards it as plain text.. this is driving me batty.. how do I forward such mails INTACT??

    I have the latest Thunderbird installed on a new 64-bit Winblows Eight netbook.. fantastic program, but one problem is driving me absolutely batty, and after using the latest Thunderbird for weeks, I simply can't figure out how to fix it..
    I'm on a lot of mfr. and other kinds of mailing lists, like eBay watch list alerts, and so on.. these are not s p a m (although I get plenty of that.. who doesn't).. but lists I WANT to be on..
    Many such emails from those mailing lists are in HTML format with embedded graphics.. I'm not talking about graphic file attachments, but embedded graphics which are coming from the senders' servers, and appear AS a graphic in the email.. sometimes such emails are one huge graphic with hardly any text.. all well and good..
    However, here's the problem.. when I want to forward such an email to a friend, Thunderbird ALWAYS formats it as plain ASCII text.. I know this because I look in the "sent mail" folder, and can see that it has turned an HTML email with embedded graphics into plain ASCII text..
    I absolutely can't figure out how to get it to forward an HTML email with embedded graphics INTACT, so the sender receives it looking the way it looks when I receive it from a mailing list, or an advertiser, or eBay, or whoever..
    Is Thunderbird capable of forwarding an HTML email with embedded graphics INTACT?.. If so, how / where do I turn on that capability?..
    If the capability to do this isn't built into the program, is there an add-on I can install that will give it that ability?..
    I am not new to computers.. but this really has me stumped.. I want to put Thunderbird on my 32-bit Vista laptop and stop using its horrible "Windoze Mail" program, which I've been using for years, and is slower than snot, and has all kinds of other problems..
    So, assuming whoever reads this FULLY understands my question, PLEASE tell me how to get Thunderbird to have the ability to forward an HTML email with embedded graphics AS-IS, so the receiver(s) I forward it to see it exactly the way I see it when I receive it.. if that ability is built in, please tell me how to turn it on.. if that ability is not built-in, please tell me what add-on I need to install to give Thunderbird this capability.. if Thunderbird absolutely can't forward an HTML email with embedded graphics at all, please also tell me that..
    A virtual box of candy and a dozen long-stemmed roses to anyone who can give me a solution that works..
    Thanks..

    Dear Mr. Toad (my all-time favorite ride at Disneyland ;-) ..
    Thanks so much for your detailed reply.. my netbook is in the bedroom, turned off.. I (so far) only use it in the evening, in the bedroom.. I've saved your response, and will try your suggestions, and let you know if they solve the problem I described. I really appreciate you taking the time to post such a detailed reply..
    I can't answer your Thunderbird "configuration" questions, because I'm in the living room, using the crap Vista laptop, on which I plan to install Thunderbird, and then take Windoze Mail out in the street and drive over it a few times.. I'll get back to you one way or the other, and let you know if your instructions solved the problem, or not..
    I don't understand why Thunderbird "out of the box", so to speak, simply doesn't forward HTML emails with embedded graphics, (like Outlook Excess, and Winblows Mail do).. without having to go through those steps. I personally HATE HTML email, but over the years, it's become more and more prevelant.. so it's a problem I must fix..
    Thanks again..
    Harv..

  • How to send an HTML email?

    Hey guys
    For the longest time I've been wanting to send HTML emails with Mail, not for promotional stuff, but more for thanking our clients for their business. This is the perfect holiday season to send a Thank You email to them, but I don't want just to send a plain and boring text email, I want graphics on it. I know this wasn't possible to do with any previous OSX until Tiger. This is what the Mail page says... - HTML Message Composition - Mail uses the Safari engine to format newly composed email using HTML. I read another post about an HTML Script to work with mail but it got so confusing that I wasn't able to make it work. Can anybody tell how to make this work? A step-by-step tutorial would be great, not just for me but for all those Mail users that are trying to do the same thing. If Apple can send those HTML emails and Newsletters, why can't we? I don't think they're using a Windows computer or any other email software to do this. Better not! :P
    This is the post I read, but it was posted a year ago, so I know there's got to be something more up to date.
    http://discussions.apple.com/message.jspa?messageID=667497&ft=y&amp;#667497
    Thanks a lot in advance!

    Hello Luis.
    Although RTF with Tiger Mail is basic HTML, you can't compose complex HTML within the body of a message.
    You can use an HTML composer of choice to include embedded images/graphics and/or objects that are stored on a server (to be downloaded/rendered from the server) when the message is opened by recipients instead of attaching images/graphics to the message.
    After saving the document, you can open the document with Safari to ensure the layout and settings are correct and at the menu bar, choose Edit > Mail Contents of This Page.
    A new Mail.app message will open and the contents of the webpage will be copied to the message and it will be sent in its entirety.

  • Html email with blob attachment and authentication

    I have been looking for a plsql package to send html emails with blob attachments. The html portion and the blob attachment are more than 32k.
    Also the email server needs to be authenticated.
    Does anyone know of something already written to do this? I’ve found lots of code that does one or two items but not all.
    Must:
    - Authenticate
    - Html email
    - Accept blob as input parameter for attachment
    - Exceed 32k
    There are so many routines, I’ve been searching looking for one which does all.

    This works for authentication:
    utl_smtp.command(l_mail_conn, 'AUTH LOGIN' );
    utl_smtp.command(l_mail_conn,utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw ( v_username ))));
    utl_smtp.command(l_mail_conn,utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw ( v_password ))));

  • Sending Unicode HTML email from Oracle

    Dear All,
    How we can send the HTML email from Oracle in Unicode format (I am using Arabic Language, to be specific). So far I have tried the following solutions (using utl_smpt) without any success (either i see junk characters in the email or see question marks). Would you please help me in solving this?
    Options Tried*
    Option 1
    SQL> ed
    Wrote file afiedt.buf
      1  CREATE OR REPLACE PROCEDURE p_send_mail_test (
      2  sender IN VARCHAR2,
      3  recipient IN VARCHAR2,
      4  subj IN VARCHAR2,
      5  message IN VARCHAR2)
      6  IS
      7  mailhost VARCHAR2(30) := '<smtp Server>';
      8  c utl_smtp.connection;
      9  PROCEDURE send_header( name IN VARCHAR2, header IN VARCHAR2) AS
    10  BEGIN
    11  utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF);
    12  END;
    13  BEGIN
    14  c := utl_smtp.open_connection(mailhost,25);
    15  utl_smtp.helo(c, mailhost);
    16  utl_smtp.mail(c, sender);
    17  utl_smtp.rcpt(c, recipient);
    18  utl_smtp.open_data(c);
    19  send_header('From', sender);
    20  send_header('To', recipient);
    21  -- If you need to send mail to more than one receipient, uncomment the
    22  -- following line(s) as appropriate. Please don't forget the ","
    23  -- in the "To" line before the next receipient's email id. You can't
    24  -- use a comma separated list in the receipient parameter.
    25  -- For variable number of "To"'s and "Cc"'s have multiple calls to
    26  -- "send_header" function inside a cursor for loop.
    27  -- Similar comments apply for "Cc" too.
    28  -- send_header('To', ',<email@domain>');
    29   send_header('Cc', ',<email@domain>');
    30  send_header('Subject', subj);
    31  utl_smtp.write_data(c, utl_tcp.CRLF || message);
    32  utl_smtp.close_data(c);
    33  utl_smtp.quit(c);
    34  EXCEPTION
    35  WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    36  utl_smtp.quit(c);
    37  raise_application_error(-20000,
    38  'Failed to send mail due to the following error: ' || sqlerrm);
    39* END;
    SQL>
    SQL> /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2   email_text varchar2(2000);
      3   contract_end_date_v date := sysdate;
      4   name_v varchar2(200) := 'Riaz';
      5   begin
      6    email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||'  المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى  <br/>.ولكم جزيل الشكر والتقدير  </font></div>';
      7    p_send_mail_test('<email@domain>','<email@domain>','Hello',email_text);
      8*  end;
    SQL> /
    PL/SQL procedure successfully completed.
    Result_
    <div align="right"><font size="4"><b>????? Riaz ???????</b>
    ???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
    .???? ???? ????? ???????? </font></div>
    [Question marks along with all tags; this OTN page is converting that to HTML output]
    Option2
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure html_email(
      2      p_to            in varchar2,
      3      p_from          in varchar2,
      4      p_subject       in varchar2,
      5      p_text          in varchar2 default null,
      6      p_html          in varchar2 default null
      7  )
      8  is
      9      l_boundary      varchar2(255) default 'a1b2c3d4e3f2g1';
    10      l_connection    utl_smtp.connection;
    11      l_body_html     clob := empty_clob;  --This LOB will be the email message
    12      l_offset        number;
    13      l_ammount       number;
    14      l_temp          varchar2(32767) default null;
    15      l_smtp_hostname varchar2(50) := '<smtp Server>';
    16  begin
    17      l_connection := utl_smtp.open_connection( l_smtp_hostname, 25);
    18      utl_smtp.helo( l_connection, l_smtp_hostname );
    19      utl_smtp.mail( l_connection, p_from );
    20      utl_smtp.rcpt( l_connection, p_to );
    21      l_temp := l_temp || 'MIME-Version: 1.0' ||  chr(13) || chr(10);
    22      l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
    23      l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
    24      l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
    25      l_temp := l_temp || 'Reply-To: ' || p_from ||  chr(13) || chr(10);
    26      l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
    27                           chr(34) || l_boundary ||  chr(34) || chr(13) ||
    28                           chr(10);
    29      ----------------------------------------------------
    30      -- Write the headers
    31      dbms_lob.createtemporary( l_body_html, false, 10 );
    32      dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
    33      ----------------------------------------------------
    34      -- Write the text boundary
    35      l_offset := dbms_lob.getlength(l_body_html) + 1;
    36      l_temp   := '--' || l_boundary || chr(13)||chr(10);
    37      l_temp   := l_temp || 'content-type: text/plain;charset=utf-8' ||
    38                    chr(13) || chr(10) || chr(13) || chr(10);
    39      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    40      ----------------------------------------------------
    41      -- Write the plain text portion of the email
    42      l_offset := dbms_lob.getlength(l_body_html) + 1;
    43      dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
    44      ----------------------------------------------------
    45      -- Write the HTML boundary
    46      l_temp   := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
    47                      chr(13) || chr(10);
    48      l_temp   := l_temp || 'content-type: text/html;charset=utf-8' ||
    49                     chr(13) || chr(10) || chr(13) || chr(10);
    50      l_offset := dbms_lob.getlength(l_body_html) + 1;
    51      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    52      ----------------------------------------------------
    53      -- Write the HTML portion of the message
    54      l_offset := dbms_lob.getlength(l_body_html) + 1;
    55      dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
    56      ----------------------------------------------------
    57      -- Write the final html boundary
    58      l_temp   := chr(13) || chr(10) || '--' ||  l_boundary || '--' || chr(13);
    59      l_offset := dbms_lob.getlength(l_body_html) + 1;
    60      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    61      ----------------------------------------------------
    62      -- Send the email in 1900 byte chunks to UTL_SMTP
    63      l_offset  := 1;
    64      l_ammount := 1900;
    65      utl_smtp.open_data(l_connection);
    66      while l_offset < dbms_lob.getlength(l_body_html) loop
    67          utl_smtp.write_data(l_connection,
    68                              dbms_lob.substr(l_body_html,l_ammount,l_offset));
    69          l_offset  := l_offset + l_ammount ;
    70          l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
    71      end loop;
    72      utl_smtp.close_data(l_connection);
    73      utl_smtp.quit( l_connection );
    74      dbms_lob.freetemporary(l_body_html);
    75* end;
    SQL> /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2   email_text varchar2(2000);
      3   contract_end_date_v date := sysdate;
      4   name_v varchar2(200) := 'Riaz';
      5   begin
      6    email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||'  المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى  <br/>.ولكم جزيل الشكر والتقدير  </font></div>';
      7    html_email(p_to=>'<email@domain>',p_from=>'<email@domain>',p_subject=>'Hello',p_text=>'Hi', p_html=>email_text);
      8*  end;
    SQL> /
    PL/SQL procedure successfully completed.
    Result*
    ????? Riaz ???????
    ???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
    Option3
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure p_html_email_riaz(
      2      p_to            in varchar2,
      3      p_from          in varchar2,
      4      p_subject       in varchar2,
      5      p_text          in varchar2 default null,
      6      p_html          in varchar2 default null
      7  )
      8  is
      9      l_boundary      varchar2(255) default 'a1b2c3d4e3f2g1';
    10      l_connection    utl_smtp.connection;
    11      l_body_html     clob := empty_clob;  --This LOB will be the email message
    12      l_offset        number;
    13      l_ammount       number;
    14      l_temp          varchar2(32767) default null;
    15      l_smtp_hostname varchar2(50) := '<smtp Server>';
    16  begin
    17      l_connection := utl_smtp.open_connection( l_smtp_hostname, 25);
    18      utl_smtp.helo( l_connection, l_smtp_hostname );
    19      utl_smtp.mail( l_connection, p_from );
    20      utl_smtp.rcpt( l_connection, p_to );
    21      l_temp := l_temp || 'MIME-Version: 1.0' ||  chr(13) || chr(10);
    22      l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
    23      l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
    24      l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
    25      l_temp := l_temp || 'Reply-To: ' || p_from ||  chr(13) || chr(10);
    26      l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
    27                           chr(34) || l_boundary ||  chr(34) || chr(13) ||
    28                           chr(10);
    29      ----------------------------------------------------
    30      -- Write the headers
    31      dbms_lob.createtemporary( l_body_html, false, 10 );
    32      dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
    33      ----------------------------------------------------
    34      -- Write the text boundary
    35      l_offset := dbms_lob.getlength(l_body_html) + 1;
    36      l_temp   := '--' || l_boundary || chr(13)||chr(10);
    37      l_temp   := l_temp || 'content-type: text/plain; charset=UTF-8' ||
    38                    chr(13) || chr(10) || chr(13) || chr(10);
    39      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    40      ----------------------------------------------------
    41      -- Write the plain text portion of the email
    42  /**
    43      l_offset := dbms_lob.getlength(l_body_html) + 1;
    44      dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
    45  **/
    46      ----------------------------------------------------
    47      -- Write the HTML boundary
    48      l_temp   := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
    49                      chr(13) || chr(10);
    50      l_temp   := l_temp || 'content-type: text/html;' ||
    51                     chr(13) || chr(10) || chr(13) || chr(10);
    52      l_offset := dbms_lob.getlength(l_body_html) + 1;
    53      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    54      ----------------------------------------------------
    55      -- Write the HTML portion of the message
    56      l_offset := dbms_lob.getlength(l_body_html) + 1;
    57      dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
    58      ----------------------------------------------------
    59      -- Write the final html boundary
    60      l_temp   := chr(13) || chr(10) || '--' ||  l_boundary || '--' || chr(13);
    61      l_offset := dbms_lob.getlength(l_body_html) + 1;
    62      dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    63      ----------------------------------------------------
    64      -- Send the email in 1900 byte chunks to UTL_SMTP
    65      l_offset  := 1;
    66      l_ammount := 1900;
    67      utl_smtp.open_data(l_connection);
    68      while l_offset < dbms_lob.getlength(l_body_html) loop
    69          utl_smtp.write_raw_data(l_connection,
    70              utl_raw.cast_to_raw(
    71                  dbms_lob.substr(l_body_html,l_ammount,l_offset ) ) );
    72          l_offset  := l_offset + l_ammount ;
    73          l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
    74      end loop;
    75      utl_smtp.close_data(l_connection);
    76      utl_smtp.quit( l_connection );
    77      dbms_lob.freetemporary(l_body_html);
    78* end;
    SQL>
    SQL> /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2   email_text varchar2(2000);
      3   contract_end_date_v date := sysdate;
      4   name_v varchar2(200) := 'Riaz';
      5   begin
      6    email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||'  المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى  <br/>.ولكم جزيل الشكر والتقدير  </font></div>';
      7    p_html_email_riaz(p_to=>'<email@domain>',p_from=>'<email@domain>',p_subject=>'Hello',p_text=>'Hi', p_html=>email_text);
      8*  end;
    SQL> /
    PL/SQL procedure successfully completed.
    Result*
    GaSmO Riaz GacMJQc
    mQLl GaJ_Qc HGaZac Cd GaZ^O GaNGU H_c SmdJem HJGQmN 12-07-2011
    . fZame mQL\l GaJ_\Qc HE]GOI EOGQI GacfGQO GaHTQmI ]m MGa ZOc Q[HJ_c HJLOmO GaZ^O NaGa cOI C^UeG CSHfZmd cd Gamfc fPa_ aaCecmI Ga^Ufl
    .fa_c LRma GaT_Q fGaJ^OmQ
    *Option4*
    [code]
    SQL> ed
    Wrote file afiedt.buf
    1 CREATE OR REPLACE PROCEDURE send_email_html_test(
    2 pi_from IN Varchar,
    3 pi_to IN VARCHAR,
    4 pi_cc IN Varchar,
    5 pi_subj IN VARCHAR,
    6 pi_msg CLOB
    7 )
    8 IS
    9 conn utl_smtp.connection;
    10 lv_mailhost varchar2(1000);
    11 lv_port number;
    12 BEGIN
    13 lv_mailhost := '<smtp Server>';
    14 lv_port := 25;
    15 conn := utl_smtp.open_connection(lv_mailhost, lv_port);
    16 utl_smtp.helo(conn, lv_mailhost);
    17 utl_smtp.mail(conn, pi_from);
    18 utl_smtp.rcpt(conn, pi_to);
    19 IF pi_cc is not null THEN
    20 utl_smtp.rcpt(conn, pi_cc);
    21 END IF;
    22 utl_smtp.open_data(conn);
    23 utl_smtp.write_data(conn, 'MIME-version: 1.0' || utl_tcp.CRLF);
    24 utl_smtp.write_data(conn, 'Content-Type: text/html; charset=iso-8859-6' ||
    25 utl_tcp.CRLF);
    26 utl_smtp.write_data(conn, 'Content-Transfer-Encoding: 8bit' ||
    27 utl_tcp.CRLF);
    28 utl_smtp.write_data(conn, 'From:' ||pi_from || utl_tcp.CRLF);
    29 utl_smtp.write_data(conn, 'To:' ||pi_to || utl_tcp.CRLF);
    30 utl_smtp.write_data(conn, 'Cc:' ||pi_cc || utl_tcp.CRLF);
    31 utl_smtp.write_data(conn, 'Reply-To:' ||pi_from || utl_tcp.CRLF);
    32 utl_smtp.write_data(conn, 'Subject:' ||pi_subj|| utl_tcp.CRLF);
    33 utl_smtp.write_data(conn, utl_tcp.crlf);
    34 utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(pi_msg));
    35 utl_smtp.close_data(conn);
    36 utl_smtp.quit(conn);
    37 EXCEPTION WHEN others THEN
    38 dbms_output.put_line(sqlerrm);
    39* END;
    40 /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
    1 declare
    2 email_text varchar2(2000);
    3 contract_end_date_v date := sysdate;
    4 name_v varchar2(200) := 'Riaz';
    5 begin
    6 email_text :='
    <div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b>
    يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'
    . وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى
    .ولكم جزيل الشكر والتقدير </font></div>';
    7 send_email_html_test('<email@domain>',
    8           '<email@domain>',
    9 '<email@domain>',
    10 'Hello',email_text);
    11* end;
    SQL> /
    PL/SQL procedure successfully completed.
    Result*
    Riaz افكحترك
    ٍرجٌ افترك بافغفك أل افغد افخاص بك سٍلتمٍ بتارٍخ 12-07-2011
    . نغفٍم ٍرجٌ افترك بإادة إدارة افكنارد افبشرٍة ٍ حاف غدك ربتك بتجدٍد افغد خفاف كدة أصما أسبنغٍل كل افٍنك نذف ففأمكٍة افصنٌ
    .نفك جزٍف افشر نافتدٍر
    Option5
    SQL> ed
    Wrote file afiedt.buf
      1  CREATE OR REPLACE PROCEDURE send_mail_test1 (p_to        IN VARCHAR2,
      2                                         p_from      IN VARCHAR2,
      3                                         p_subject   IN VARCHAR2,
      4                                         p_text_msg  IN VARCHAR2 DEFAULT NULL,
      5                                         p_html_msg  IN VARCHAR2 DEFAULT NULL,
      6                                         p_smtp_host IN VARCHAR2,
      7                                         p_smtp_port IN NUMBER DEFAULT 25)
      8  AS
      9    l_mail_conn   UTL_SMTP.connection;
    10    l_boundary    VARCHAR2(50) := '----=*#abc1234321cba#*=';
    11  BEGIN
    12    l_mail_conn := UTL_SMTP.open_connection(p_smtp_host, p_smtp_port);
    13    UTL_SMTP.helo(l_mail_conn, p_smtp_host);
    14    UTL_SMTP.mail(l_mail_conn, p_from);
    15    UTL_SMTP.rcpt(l_mail_conn, p_to);
    16    UTL_SMTP.open_data(l_mail_conn);
    17    UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || UTL_TCP.crlf);
    18    UTL_SMTP.write_data(l_mail_conn, 'To: ' || p_to || UTL_TCP.crlf);
    19    UTL_SMTP.write_data(l_mail_conn, 'From: ' || p_from || UTL_TCP.crlf);
    20    UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || p_subject || UTL_TCP.crlf);
    21    UTL_SMTP.write_data(l_mail_conn, 'Reply-To: ' || p_from || UTL_TCP.crlf);
    22    UTL_SMTP.write_data(l_mail_conn, 'MIME-Version: 1.0' || UTL_TCP.crlf);
    23    UTL_SMTP.write_data(l_mail_conn, 'Content-Type: multipart/alternative; boundary="' || l_boundary || '"' || UTL_TCP.crlf || UTL_TCP.crlf);
    24    IF p_text_msg IS NOT NULL THEN
    25      UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
    26      UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/plain; charset="utf-8"' || UTL_TCP.crlf || UTL_TCP.crlf);
    27      UTL_SMTP.write_data(l_mail_conn, p_text_msg);
    28      UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
    29    END IF;
    30    IF p_html_msg IS NOT NULL THEN
    31      UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
    32      UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/html; charset="utf-8"' || UTL_TCP.crlf || UTL_TCP.crlf);
    33      UTL_SMTP.write_data(l_mail_conn, p_html_msg);
    34      UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
    35    END IF;
    36    UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || '--' || UTL_TCP.crlf);
    37    UTL_SMTP.close_data(l_mail_conn);
    38    UTL_SMTP.quit(l_mail_conn);
    39* END;
    SQL> /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2   email_text varchar2(2000);
      3   contract_end_date_v date := sysdate;
      4   name_v varchar2(200) := 'Riaz';
      5   begin
      6    email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||'  المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى  <br/>.ولكم جزيل الشكر والتقدير  </font></div>';
      7    send_mail_test1('<email@domain>',
      8                   '<email@domain>',
      9                         'Hello',
    10                 'msg',
    11                 email_text,
    12                 '<smtp Server>',
    13                 25);
    14*  end;
    SQL> /
    PL/SQL procedure successfully completed.
    Result*
    ????? Riaz ???????
    ???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
    .???? ???? ????? ????????

    I worked with Oracle support and was able to find solution. The helping document ids were: 752309.1 & 404389.1

  • How do i send a html email from office outlook web access?

    how do i send a html email from office outlook web access?

        glenholmes,
    You've come to the right place for help. Sorry to hear that you have had hard time with your Gmail app lately. What steps have you tried to get this to work? We want to ensure that you are able to start sending those messages right away.
    ErinW_VZW
    Follow us on Twitter @VZWSupport

  • How to send a sms email with a 5310

    I am trying to figure out how to send a Sms Email with my new 5310 xpress music it only allows me to enter numbers in the to box

    i would guess that you are trying to write the message possibly in the field designed for a contact name or phone number that you would like to send it to, if you go down to the rest of the lines you will be able to type your message. this is just a guess but it sounds like this might be the issue. if not please elaborate so we can assist you better. 
    You know what I love about you the most, the fact that you are not me ! In love with technology and all that it can offer. Join me in discovery....

  • TS3276 how to send a group email with iPhone 5

    how to send a group email with iPhone 5

    I have a new OSX 27" iMac that is running Maverick. 
    RE: group emails, I am trying to omit individual recients and have tried the following options without success.
    1) Mail- Composing- checked "Automatically- Bcc"
    2) Mail- Composing- unchecked "when sending to a group, show all member addresses"
    The result is that all names continue to show up with email addresses for group emails.
    HELP!  HELP!  HELP!
    Lynn 

  • How to send invoice through email with output type RD00?

    What are the configuration settings to send invoices through email with output type RD00?

    Hi,
    Please go through the following links:
    [E-mail|Email Configuration Settings]
    [e-mail|Re: EMAIL BILLING DOCUMENT TO CUSTOMER THROUGH SEND MAIL OPTION IN VF02]
    After triggering the output,goto T.Code SOST and process it.
    So that e-mail will be triggered immediately.
    You can use External send/EDI/simple mail for this.
    Regards,
    Krishna.

Maybe you are looking for

  • Flex 3 : Mx:Text is acting differently

    Hi , I am using Flex 3 for developing my Application . I have a Text making it display as an Hyper Link : <mx:Text x="1010" y="30" fontSize="15" fontFamily="Courier New" color="#B9C0C1" click="openSearchCOmp()">      <mx:htmlText  >         <![CDATA[

  • Back ground job scheduling(urgent)

    Hi all,   can anybody will help me ,regarding the step by step procedure to schedule the background job. i have to do back ground job scheduling for one program so that in that specified time my report will execute? plz suggest. ur idea will be highl

  • Oracle b2b API's

    Hi Guru's We want to have some mechanism to enable/disable the delivery channels programicatlly. We know how to do them manually but we want to know if there are any API's / service there which can help us in automate this. Why we wan't to do is that

  • Why does my ipod and computer hate me?

    Okay, i spent 2 weeks trying to get my ipod music INTO my itunes library. It worked! I was happy, lahdeedahdeedah. Then (of course) my computer crashed and i have had to get it reformated again. I kept all the papers that helped me get my ipod music

  • JMSException in createConnection

    Hi when i started my test server in websphere 5.1 to test JMS with MDB , i got the following error *** Starting the server *** ************ Start Display Current Environment ************ WebSphere Platform 5.1 [BASE 5.1.0 b0344.02] running with proce