Tracking Undelivered E-Mail using UTL_SMTP

I am sending e-mail using UTL_SMTP. If there is any error in the e-mail delivery for e.g. say if the E-Mail bounced etc. then can i capture those events in my code?
E-Mail can bounce back for any reason. for e.g. e-mail address is not valid. What all error we can capture using UTL_SMTP?
Edited by: LostWorld on Jan 26, 2011 11:34 PM

LostWorld wrote:
I am sending e-mail using UTL_SMTP. If there is any error in the e-mail delivery for e.g. say if the E-Mail bounced etc. then can i capture those events in my code?Yes. But not via SMTP.
The SMTP server receives the mail. It tells the client (your code, mail reader, whatever) that is has accepted the connection. That is the extent of the conversation. The SMTP protocol does not report on delivery steps, delivery status and so on.
From a SMTP protocol perspective, the mail payload was delivered to that server. And that's it.
The mail delivery runs into a problem. It could be on the SMTP server that accepted your mail. It could be a SMTP server on the other side of the world that is passing your e-mail along, 24 hours later.
There are 2 types of problems. A soft bounce. This means that the server attempted delivery, and it failed - but the delivery attempt can be retried. For example, there could be a network problem (and this could shortly be rectified). In such a case, that SMTP server will look at the sender's address and send a soft bounce notification to the sender. It will describe the basic problem and how it will be handled - e.g. mail server may perform 3 more attempts at delivery in the next 12h and then hard bounce your e-mail.
A hard bounce is a fatal error. For example, the SMTP server attempts to deliver your e-mail to its final destination (the mail server of the recipient's domain). That server says that the recipient (mail user) does not exist at that domain.
In that case, the SMTP server will send the sender of that e-mail a hard bounce notification - informing the sender of what the fatal error is.
So in order to get the bounce message, you need to supply a valid sender e-mail address when delivering that e-mail to the SMTP server. You then need to monitor that e-mail account (using the POP3 or IMAP protocols) for bounce e-mail notifications.
However, even that will not indicate whether that original e-mail your code send was delivered successfully. And this is the bottom line - there are no guarantees. The SMTP and POP3/IMAP protocols cannot and do not guarantee you being able to determine whether or not an e-mail reached its intended destination.
This is often why e-mails are send with a URL and a request that the recipient please click the URL when receiving the e-mail. That is the only method to determine whether the recipient received the e-mail, provided the recipient is willing to click that URL in that e-mail message.

Similar Messages

  • Sending e-mail using utl_smtp on oracle 9i

    Hello
    I have problem with sending e-mails using utl_smtp package.
    My code looks like this:
    lv_mail_conn := utl_smtp.open_connection(lv_mailhost_txt);
    utl_smtp.ehlo(lv_mail_conn, lv_mailhost_txt);
    res :=     utl_smtp.command(lv_mail_conn, 'AUTH LOGIN');
    res := utl_smtp.command(lv_mail_conn, <login in base64>);
    res := utl_smtp.command(lv_mail_conn, <password in base64>);
    And I get en error after sending a password to SMTP server.
    Error code: 535, text: 5.7.3 Authentication unsuccessful.
    This happens on oracle 9i.
    I have another server for testing which has oracle 10g installed. This code works fine on oracle 10g but doesn't work on oracle 9i.
    Do you have any ideas what's wrong? I assume that SMTP server (microsoft exchange) work correctlys because I can send e-mail from test server.

    Ok problem solved :)
    Problem was between oracle and MS exchange server. Live server oracle 9i is on linux, and testing server works on windows.
    So the problem was with configuration. Our admins corrected it and now works :). I don't know details.

  • Send mail using utl_smtp

    Hi Experts,
    I am using utl_smtp package to send a mail from oracle procedure. My procedure is
    CREATE OR REPLACE PROCEDURE TEST_UTLFILE_EMAIL (pSender VARCHAR2, pRecipient VARCHAR2, pSubject VARCHAR2, pMessage VARCHAR2) IS
    mailhost CONSTANT VARCHAR2(30) := 'host';
    crlf CONSTANT VARCHAR2(2):= CHR(13) || CHR(10);
    mesg VARCHAR2(1000);
    mail_conn utl_smtp.connection;
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    mesg := 'Date: ' ||
    TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf ||
    'From: <'|| pSender ||'>' || crlf ||
    'Subject: '|| pSubject || crlf ||
    'To: '||pRecipient || crlf || '' || crlf || pMessage;
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, pSender);
    utl_smtp.rcpt(mail_conn, pRecipient);
    utl_smtp.data(mail_conn, mesg);
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN INVALID_OPERATION THEN
    NULL;
    WHEN TRANSIENT_ERROR THEN
    NULL;
    WHEN PERMANENT_ERROR THEN
    NULL;
    WHEN OTHERS THEN
    NULL;
    END TEST_UTLFILE_EMAIL;
    when i compiled this procedure, this is giving following error message.
    LINE/COL ERROR
    0/0 PL/SQL: Compilation unit analysis terminated
    19/8 PLS-00201: identifier 'INVALID_OPERATION' must be declared
    Please help me out in solving this.
    Regards,
    Chandu

    Define the exception's like
    CREATE OR REPLACE PROCEDURE TEST_UTLFILE_EMAIL(pSender VARCHAR2,
    pRecipient VARCHAR2,
    pSubject VARCHAR2,
    pMessage VARCHAR2) IS
    mailhost CONSTANT VARCHAR2(30) := 'host';
    crlf CONSTANT VARCHAR2(2) := CHR(13) || CHR(10);
    mesg VARCHAR2(1000);
    mail_conn utl_smtp.connection;
    invalid_operation EXCEPTION; -- Operation is invalid
    transient_error EXCEPTION; -- Transient server error in 400 range
    permanent_error EXCEPTION; -- Permanent server error in 500 range
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    mesg := 'Date: ' || TO_CHAR(SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf ||
    'From: <' || pSender || '>' || crlf || 'Subject: ' ||
    pSubject || crlf || 'To: ' || pRecipient || crlf || '' || crlf ||
    pMessage;
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, pSender);
    utl_smtp.rcpt(mail_conn, pRecipient);
    utl_smtp.data(mail_conn, mesg);
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN INVALID_OPERATION THEN
    NULL;
    WHEN TRANSIENT_ERROR THEN
    NULL;
    WHEN PERMANENT_ERROR THEN
    NULL;
    WHEN OTHERS THEN
    NULL;
    END TEST_UTLFILE_EMAIL;

  • Mail using utl_smtp package

    can we send attachment with mail by using utl_smtp package.
    i am using form6i with database 9i in 2 tier environment

    Hi,
    read the following:
    Can 9i email utl_smtp send attachments? ,
    Re: sending attchements with utl_smtp
    As an alternative there is also the UTL_MAIL built-in package as well...
    Regards,
    Simon

  • How to put an image to any part of an e-mail using UTL_SMTP

    We need to send an e-mail with the following format.
    |COMPANY LOGO (JPEC IMAGE)          |
    |                                    |
    |                                    |
    |              HTML table            |
    |                                    |
    |                                    |
    ------------------------------------The exact format is shown here: http://postimage.org/image/76v4e5tmd/
    Above the Automatic Payment Advice is the JPEG image.
    How do we CONSTRUCT THIS e-mail? Our DB is a 10g R2. We use UTL_SMTP. Problem is how to insert an image to any part of the e-mail (not as a separate attachment)?
    Edited by: Channa on May 24, 2012 5:51 AM

    Yes. It is possible. Read this posts of Billy Verreynne to uderstand the MIME format.
    Re: Sending HTML mail with inline/embeded images (My code is constructed on this input)
    embeded image in email body in pl/sql
    DECLARE
      /*LOB operation related varriables */
      v_src_loc  BFILE := BFILENAME('TEMP', 'otn.jpg');
      l_buffer   RAW(54);
      l_amount   BINARY_INTEGER := 54;
      l_pos      INTEGER := 1;
      l_blob     BLOB := EMPTY_BLOB;
      l_blob_len INTEGER;
      v_amount   INTEGER;
      /*UTL_SMTP related varriavles. */
      v_connection_handle  UTL_SMTP.CONNECTION;
      v_from_email_address VARCHAR2(30) := '[email protected]';
      v_to_email_address   VARCHAR2(30) := '[email protected]';
      v_smtp_host          VARCHAR2(30) := 'x.xxx.xxx.xxx'; --My mail server, replace it with yours.
      v_subject            VARCHAR2(30) := 'Your Test Mail';
      l_message            VARCHAR2(32767) := '<html>
    <meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
    <body background=3D"cid:[email protected]">
    ..rest of mail
    </body>
    </html>
      /* This send_header procedure is written in the documentation */
      PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
      BEGIN
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            pi_name || ': ' || pi_header || UTL_TCP.CRLF);
      END;
    BEGIN
      /*Preparing the LOB from file for attachment. */
      DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
      DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
      v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
      DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
      l_blob_len := DBMS_LOB.getlength(l_blob);
      /*UTL_SMTP related coding. */
      v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host);
      UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
      UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
      UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
      UTL_SMTP.OPEN_DATA(v_connection_handle);
      send_header('From', '"Sender" <' || v_from_email_address || '>');
      send_header('To', '"Recipient" <' || v_to_email_address || '>');
      send_header('Subject', v_subject);
      --MIME header.
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'MIME-Version: 1.0' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'Content-Type: multipart/related; ' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          ' boundary= "' || 'SAUBHIK.SECBOUND' || '"' ||
                          UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
      -- Mail Body
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'Content-Type: text/html;' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          ' charset=US-ASCII' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'Content-Transfer-Encoding: quoted-printable' || UTL_TCP.CRLF);                     
      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle, l_message || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
      -- Mail Attachment
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'Content-Disposition: inline; filename="otn.jpg"' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'Content-Type: image/jpg; name="otn.jpg"' ||
                          UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'Content-ID: <[email protected]>; ' ||
                          UTL_TCP.CRLF);                     
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
      /* Writing the BLOL in chunks */
      WHILE l_pos < l_blob_len LOOP
        DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
        UTL_SMTP.write_raw_data(v_connection_handle,
                                UTL_ENCODE.BASE64_ENCODE(l_buffer));
        UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
        l_buffer := NULL;
        l_pos    := l_pos + l_amount;
      END LOOP;
      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
      -- Close Email
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          '--' || 'SAUBHIK.SECBOUND' || '--' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
      UTL_SMTP.CLOSE_DATA(v_connection_handle);
      UTL_SMTP.QUIT(v_connection_handle);
      DBMS_LOB.FREETEMPORARY(l_blob);
      DBMS_LOB.FILECLOSE(v_src_loc);
    EXCEPTION
      WHEN OTHERS THEN
        UTL_SMTP.QUIT(v_connection_handle);
        DBMS_LOB.FREETEMPORARY(l_blob);
        DBMS_LOB.FILECLOSE(v_src_loc);
        RAISE;
    END;Otn logo is in my database server and It will embade otn logo all over the mail body!.
    Edited by: Saubhik on May 24, 2012 9:06 PM
    Changed the original IP and email address. I should have done this earlier!: Saubhik on May 25, 2012 11:20 AM

  • Sending  mail using utl_smtp

    (Oracle 8.1.7)
    I'm using the following procedure to send an HTML formatted e-mail. It sends email but I'm seeing in Outlook html code instead of formatted mail. (It sends text like :
    a bit of text
    --a1b2c3d4e3f2g1
    content-type: text/html;
    <html><head></head><body><B>HELLO </B></body></html>
    a1b2c3d4e3f2g1
    What can I solve this problem?
    Thanks in advance...
    its usage :
    html_email('smo@....','smo2@...','This is a subject','a bit of text', '<html><head></head><body><B>HELLO </B></body></html>', 'some hostname',25);
    CREATE OR REPLACE procedure html_email(
    p_to in varchar2,
    p_from in varchar2,
    p_subject in varchar2,
    p_text in varchar2 default null,
    p_html in varchar2 default null,
    p_smtp_hostname in varchar2,
    p_smtp_portnum in varchar2)
    is
    l_boundary varchar2(255) default 'a1b2c3d4e3f2g1';
    l_connection utl_smtp.connection;
    l_body_html clob := empty_clob; --This LOB will be the email message
    l_offset number;
    l_ammount number;
    l_temp varchar2(32767) default null;
    begin
    l_connection := utl_smtp.open_connection( p_smtp_hostname, p_smtp_portnum );
    utl_smtp.helo( l_connection, p_smtp_hostname );
    utl_smtp.mail( l_connection, p_from );
    utl_smtp.rcpt( l_connection, p_to );
    l_temp := l_temp || 'MIME-Version: 1.0' || chr(13) || chr(10);
    l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
    l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
    l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
    l_temp := l_temp || 'Reply-To: ' || p_from || chr(13) || chr(10);
    l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
    chr(34) || l_boundary || chr(34) || chr(13) ||
    chr(10);
    -- Write the headers
    dbms_lob.createtemporary( l_body_html, false, 10 );
    dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
    -- Write the text boundary
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    l_temp := '--' || l_boundary || chr(13)||chr(10);
    l_temp := l_temp || 'content-type: text/plain; charset=us-ascii' ||
    chr(13) || chr(10) || chr(13) || chr(10);
    dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    -- Write the plain text portion of the email
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
    -- Write the HTML boundary
    l_temp := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
    chr(13) || chr(10);
    l_temp := l_temp || 'content-type: text/html;' ||
    chr(13) || chr(10) || chr(13) || chr(10);
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    -- Write the HTML portion of the message
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
    -- Write the final html boundary
    l_temp := chr(13) || chr(10) || '--' || l_boundary || '--' || chr(13);
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    -- Send the email in 1900 byte chunks to UTL_SMTP
    l_offset := 1;
    l_ammount := 1900;
    utl_smtp.open_data(l_connection);
    while l_offset < dbms_lob.getlength(l_body_html) loop
    utl_smtp.write_data(l_connection,
    dbms_lob.substr(l_body_html,l_ammount,l_offset));
    l_offset := l_offset + l_ammount ;
    l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
    end loop;
    utl_smtp.close_data(l_connection);
    utl_smtp.quit( l_connection );
    dbms_lob.freetemporary(l_body_html);
    end;

    This forum is for Forms questions. Try asking this on another forum, such as the database forum or the PL/SQL forum.
    Regards,
    Robin Zimmermann
    Forms Product Management

  • Attaching files in a mail using utl_smtp package

    I am using a batch file to automate
    execution of a sql script. The script would generate a .csv file and I now need to mail this file to a user at regular intervals.
    Please suggest a good tool to attach the file and send a mail. I tried utl_smtp package, but its not possible to attach a file and also, the text size should not be more than 1000 characters.
    Thank you,

    http://www.softtreetech.com/
    has a package DB mail.
    Check this out.

  • Sending  mail data in tabular format using UTL_SMTP.

    I am using UTL_SMTP package for sending the mails after the job is running . Now there is requirement to send the same mail in Tabular Format . Is it possible to do the same . I am sending the mails using the secure server of my company.

    sunnymoon wrote:
    i need to send the mail using UTL_SMTP in which the mail body will be displayed in tabular format .You need to format a HTML Mime (Multipurpose Internet Mail Extensions) body as the e-mail. And use the HTML table element to format data into a tabular format.
    This has NOTHING to do with UTL_SMTP. SMTP is a transport protocol. It does not create Mime bodies for you. It does not do Mime formatting or parsing or whatever. It simply moves a payload from the client to the server for delivery as an e-mail.
    So your code needs to create that payload. You need to format a proper Mime body in your code. Not UTL_SMTP. Not PL/SQL.

  • Mail using smtp is going with to field blank

    Hi,
    I am sending a mail using utl_smtp .receipient is getting the mail.but problem is that he is getting it with blank 'to field'.
    Following is the code i wrote.
    CREATE OR REPLACE PROCEDURE mis_test_send_mail AS
    pfrom VARCHAR2(100):='[email protected]';
    crlf CONSTANT VARCHAR2(100):= CHR(13) || CHR(10);
    message VARCHAR2(1000);
    preceiver VARCHAR2(100):='[email protected]';
    psubject VARCHAR2(100):='Test Mail';
    mail_conn Utl_Smtp.connection;
    mailhost CONSTANT VARCHAR2(50):='mailrelay.organization.com';
    BEGIN
    message:='How Are You'||crlf;
    mail_conn:=Utl_Smtp.open_connection(mailhost);
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, pfrom);
    utl_smtp.rcpt(mail_conn, preceiver);
    utl_smtp.data(mail_conn, message);
    utl_smtp.quit(mail_conn);
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line('error :'||SQLERRM||''||SQLCODE);
    END mis_test_send_mail ;
    Any help on this is highly appreciated.
    Regards,
    Cheriyan

    You need to include any headers that need to be shown in the mail in the message data. The headers section of the data needs to be separated from the body section by at least one blank line.
    message:= 'From: "sender name" <[email protected]>' || crlf;
    message:= message || 'To: "recipient" <[email protected]>' || crlf;
    message:= message || 'Subject: this is only a test' ||crlf;
    message:= message || crlf;
    message:= message || 'How Are You' ||crlf;The utl_smtp.mail and utl_smtp.rcpt procedures just tell the recieving SMTP server who is sending it and who to deliver it to, but what the recipient sees is what's in the headers section of the utl_smtp.data payload.
    You can take advantage of this in that you can include multiple calls to utl_smtp.rcpt, but not include them in the payload's header section. This is exactly what happens when you use your mail client to send blind carbon copies of an email.

  • Maildemo example using UTL_SMTP

    Hi,
    I tried the maildemo example in your PL/SQL sample code page and I am getting the error : 421-Service not available. Can you help me solve this problem?
    I am using the same smtp host address as in my outlook express? Is there any parameter to specify my username and password while sending and receiving mails using UTL_SMTP?
    Thanx
    Jayashree

    Hi Jayashree,
    We suppose you are working with the PL/SQL Package that comes with maildemo.sql available at the following location:
    http://otn.oracle.com/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    We were successfull in sending a small email using the "mail" procedure in the PL/SQL Package created by the above SQL using the following command:
    Execute demo_mail.mail('[email protected]','[email protected]','test subject','test message');
    Can you please verify the following in your code:
    1. You have modified the following with respect to your System before running the SQL file:
    smtp_host VARCHAR2(256) := smtp-server.some-company.com';
    smtp_port PLS_INTEGER := 25;
    smtp_domain VARCHAR2(256) := 'some-company.com';
    2. We were successfull in sending a small email using the "mail" procedure in the Package. Can you let us know, while executing which procedure you are getting the "421-Service not available" exception?
    Hope it helps
    Shefali

  • How to use alias in "From" field when I send a mail with utl_smtp ?

    Hi all,
    I'm using a PL/SQL package with an Oracle 11G database to send mails. It works fine but instead of use of my mail in "From" field like "[email protected]" as sender E-mail address, I would like to have "Toto" in the sender address. I tryied to use utl_smtp.mail(l_connection, '<toto> [email protected]') but it doesn't work. The only way I can send mail is when I set utl_smtp.mail(l_connection, '<[email protected]>') directly. When I use the Alias, I have an error from smtp server telling that I use a bad syntax address.
    Does someone know how to use the alias ? Where do I do a mistake ?
    Thank you for your help.
    sis2b

    Thank you, I find how to solve the problem thanks to your link.
    I try to send HTML E-mail so I had the From in the from field writen in the header of the mail and not to initialize the connection.
    sis2b.

  • Sending mail from using utl_smtp error......

    Hi
    When i try to send mail like as follows
    DECLARE
    v_connection UTL_SMTP.CONNECTION;
    BEGIN
    v_connection := UTL_SMTP.OPEN_CONNECTION('xxx.xxx.xxx.xxx',25);
    UTL_SMTP.HELO(v_connection,'xxx.xxx.xxx.xxx');
    UTL_SMTP.MAIL(v_connection,'[email protected]');
    UTL_SMTP.RCPT(v_connection,'[email protected]');
    UTL_SMTP.DATA(v_connection,'Sent From PL/SQL');
    UTL_SMTP.QUIT(v_connection);
    END;
    I get the following error..
    ERROR at line 1:
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at "SYS.UTL_SMTP", line 17
    ORA-06512: at "SYS.UTL_SMTP", line 96
    ORA-06512: at "SYS.UTL_SMTP", line 138
    ORA-06512: at line 4
    if i send mail from outlook it goes...the configuration is like this
    in mail properties general tab
    email address : [email protected]
    and i have to tick mark the "include this account when receiving mail or synchro" option
    in servers tab
    POP3 : xxx.xxx.xxx.xxx
    smtp : xxx.xxx.xxx.xxx
    and i have to tick the "My server requires authentication" option
    and have to give the setting for that also
    ie. log on using account : [email protected]
         password: xxxxxx
    How to Correct it ?
    Kris

    i am on the same platform and in same account..... and PL/SQL UTL_SMTP gets a connection plus SMTP error, while telnet cannot even get a connection. A very weird one. Not sure what the problem can be.
    Worse case, forget telnet and do all your troubleshooting using UTL_SMTP.. with liberal usage of DBMS_OUTPUT. :-)
    regd. the connection from my xp client it is
    connecting to the telnet server on server, but when i
    tri to connect to the ISP's smtp address it throws
    the errorNot that strange. You're likely going through a proxy of sorts of to reach the ISP mail server. Besides, to send mail you should be able to use your company's SMTP server as it should route Internet e-mail out to the net automatically.
    In fact, many SMTP servers will not allow you to relay via them. E.g. if you connect from domain 1 to SMTP server on domain 2, and you submit an e-mail to be delivered to domain 3, the domain 2 server will tell you to take a hike. It will only accept mail that is destined for its own domain or originating from its own domain.
    Reason for this is spam. Open relays are one of the prime reasons for having billions of spam mails being transmitted.
    The correct method will be for you on domain 1 to connect to domain 1's SMTP server and submit an e-mail to be delivered to domain 3. That will be accepted and delivered. Using domain 2 as an intermediate agent to act as a relay, is/should not be accepted by all SMTP servers. (your SMTP server should get blacklisted/blackholed if it has an open relay)

  • Use UTL_SMTP send mail charset thai

    when I sent mail by use utl_smtp with thai language.
    and I get mail ,I found ????????????? on email
    sg := 'From:'||MSG_FROM||utl_tcp.crlf||
    'To:'||MSG_TO||utl_tcp.crlf ||
    'Subject:'||MSG_SUBJECT|| utl_tcp.crlf||utl_tcp.crlf||MSG_DETAIL;
    -- Set Message format
    utl_smtp.data(c,'MIME-Version: 1.0' ||CHR(13)|| CHR(10)||'Content-Type: text/html; charset=utf-8' ||CHR(13)||CHR(10) || 'Content-Transfer-Encoding: 8bit'|| CHR(13)||CHR(10) ||msg);
    utl_smtp.quit(c);
    Help me

    msg :=
    --'Date:'||TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss')|| utl_tcp.crlf||
    'From:'||MSG_FROM||utl_tcp.crlf||
    'To:'||MSG_TO||utl_tcp.crlf ||
    'Subject:'||MSG_SUBJECT|| utl_tcp.crlf||utl_tcp.crlf||MSG_DETAIL;
    -- Set Message format
    -- utl_smtp.data(c,'MIME-Version: 1.0' ||CHR(13)|| CHR(10)||'Content-Type: text/html; charset=utf-8' ||CHR(13)||CHR(10) || 'Content-Transfer-Encoding: 8bit'|| CHR(13)||CHR(10) ||msg);
    utl_smtp.open_data(c);
    -- utl_smtp.write_data(c,'MIME-Version: 1.0' ||CHR(13)|| CHR(10)||'Content-Type: text/html; charset=utf-8' ||CHR(13)||CHR(10) || 'Content-Transfer-Encoding: 8bit'|| CHR(13)||CHR(10) ||msg);
    utl_smtp.write_raw_data(c, utl_raw.cast_to_raw('MIME-Version: 1.0' ||CHR(13)|| CHR(10)||'Content-Type: text/html; charset=tis-620' ||CHR(13)||CHR(10) || 'Content-Transfer-Encoding: 8bit'|| CHR(13)||CHR(10) ||msg));
    utl_smtp.close_data(c);
    utl_smtp.quit(c);

  • Problem with using utl_smtp.  I'm trying to test a new e-mail procedure.

    I have the following code and I am getting the following error messages.
    1 create or replace procedure test_e is
    2 v_connection UTL_SMTP.CONNECTION;
    3 BEGIN
    4 -- v_connection := UTL_SMTP.OPEN_CONNECTION('10.128.43.113', 25);
    5 v_connection := UTL_SMTP.OPEN_CONNECTION('iadsrv113.mwaa.com', 25);
    6 UTL_SMTP.HELO(v_connection, 'iadsrv113.mwaa.com');
    7 UTL_SMTP.MAIL(v_connection, '[email protected]');
    8 UTL_SMTP.RCPT(v_connection, '[email protected]');
    9 UTL_SMTP.DATA(v_connection, 'Sent From PL/SQL - this is the first step to sending e-mails');
    10 UTL_SMTP.QUIT(v_connection);
    11* END;
    SQL> /
    Procedure created.
    SQL> exec test_e;
    BEGIN test_e; END;
    ERROR at line 1:
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 97
    ORA-06512: at "SYS.UTL_SMTP", line 139
    ORA-06512: at "PMC_ERP_PROD.TEST_E", line 5
    ORA-06512: at line 1

    you might as well try to include the exception handlers:
    EXCEPTION
      WHEN UTL_SMTP.INVALID_OPERATION THEN
        dbms_output.put_line(' Invalid Operation in SMTP transaction.');
      WHEN UTL_SMTP.TRANSIENT_ERROR THEN
        dbms_output.put_line(' Temporary problems with sending email - try again later.');
      WHEN UTL_SMTP.PERMANENT_ERROR THEN
        dbms_output.put_line(' Errors in code for SMTP transaction.');  
    END;also on line 9 of your code
    UTL_SMTP.DATA(v_connection, 'Sent From PL/SQL - this is the first step to sending e-mails'); it should be
      UTL_SMTP.OPEN_DATA(v_connection);
      UTL_SMTP.WRITE_DATA(v_connection, crlf ||'Sent From PL/SQL - this is the first step to sending e-mails');
      UTL_SMTP.CLOSE_DATA(v_connection);

  • Sending email using UTL_SMTP

    Dear experts,
    I am trying to send an email using UTL_SMTP (i switched from UTL_MAIL to UTL_SMTP since i need to send mails with large attachments - BLOB). I am using the demo_mail package given here:
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    While running the program I am getting an error message (from the error.log) saying:
    [Mon Aug 04 14:00:21 2008] [error] [client 192.168.0.7] mod_plsql: /ns/email_p.send HTTP-404 ORA-29279: SMTP permanent error: 530 5.7.0 Must issue a STARTTLS command first. 9sm12723808qbw.6\nORA-06512: at "SYS.UTL_SMTP", line 20\nORA-06512: at "SYS.UTL_SMTP", line 98\nORA-06512: at "SYS.UTL_SMTP", line 221\nORA-06512: at "NEXTSTEP.SEND_EMAIL_HELPER", line 258\nORA-06512: at "NEXTSTEP.SEND_EMAIL_HELPER", line 119\nORA-06512: at "NEXTSTEP.EMAIL_P", line 33\nORA-06512: at line 31\n, referer: file:///C:/Documents and Settings/Mayank/My Documents/Flex Builder 3/ns5/bin-debug/main.swf
    My code is as follows:
    PACKAGE DECLARATION. This is the DEMO_MAIL package posted under above link (I have renamed it).
    CREATE OR REPLACE PACKAGE NEXTSTEP.send_email_helper IS
      ----------------------- Customizable Section -----------------------
      -- Customize the SMTP host, port and your domain name below.
        smtp_host   VARCHAR2(256) := 'smtp.gmail.com';
        smtp_port   PLS_INTEGER   := 587;
        smtp_domain VARCHAR2(256) := null;
      -- 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;How should I solve the above error? Can anyone help me with my query please?
    If I add the code to start TLS it still gives me an error. If I add the code
    utl_smtp.command(conn,'STARTTLS');
    utl_smtp.helo(conn, smtp_domain);
    under email_sender_help package just before under begin_session function, it gives me an error saying:
    ORA-29279: SMTP permanent error: 503 5.5.1 EHLO/HELO first. s27sm2097329qbs.12
    So then if i enter the same code after:
    utl_smtp.command(conn,'STARTTLS');
    utl_smtp.helo(conn, smtp_domain);
    It gives me an error:
    ORA-29278: SMTP transient error: 421 Service not available
    Message was edited by:
    Monk
    Message was edited by:
    Monk

    look like rely turned off on the server..
    check this.. or ask your network guys..
    Go to Control Panel->Add or Remove Programs->Click on
    Add/Remove Wndows Components
    Check IIS check box.
    Select Internet Information Service (IIS) option and click on Details button
    Check whether SMTP Service is checked or not.
    If not selected then select SMTP check box.
    This process should be done on server.
    It will help out from ORA-29278: SMTP transient error: 421 Service not available problem.
    thanks

Maybe you are looking for

  • Print quality with Aperture and Epson RX580

    Hi all, I feel like I've tried everything, but I just can't get Aperture (the latest version with all the updates) to print from my MacBook Pro on my Epson photo printer the way I could from other photo software on my old PCs.  On my old PCs, when I

  • E-Recruiting and IE8

    <p>We are currently on E-Recruiting 6 with Enhancement Pack 3 SP level 5 with Netweaver 2004s (7.0) (support pack stack 20). </p> <p>PROBLEM <br> We did some testing with Internet Explorer 8 and the Candidate Web Dynpro seemed to work fine.  However,

  • IOS 4.2.8 iCal Alarm Bug?

    When I create an event in iCal on my iPhone 4 (Verizon iOS 4.2.8) I will set an alarm to notify me of the event, set for an hour before. The alarm/notification does not go off until 3 hours after the start of the event. Has anyone else experienced th

  • Regarding explain plan

    hi all, i am using database 10g. i have explain as below SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY); PLAN_TABLE_OUTPUT Plan hash value: 2715695103 | Id  | Operation                     | Name                   | Rows  | Bytes | Cost (%CPU)| Time   

  • Zen Vision M - help with mp3 sound quality - decreases after trans

    I use the Media Explorer to transfer songs from cd to the player. After?recently upgrading my OS to the XP service pack 2 (even though I don't know if this has anything to do with it), the sound quality of the mp3's has decreased when playing back on