Mail Error: ORA-29278: SMTP transient error: 421 Service not available

I write process to send mail, it is running ok, but I have error ORA-29278: SMTP transient error: 421 Service not available.
SMTP Host Address : localhost
SMTP Host Port : 25
When I connect to database as SYS and run : exec apex_mail.push_queue result is :
Pushing email: 1225814842675154
Pushed email: 1225814842675154
PL/SQL procedure successfully completed.
Please explain me what is happened!

Hi;
What is DB version?
Please see:
From Master Note For PL/SQL UTL_SMTP and UTL_MAIL Packages [ID 1137673.1] check Note 604763.1 "ORA-29278: SMTP transient error: 421 Service not available" When Using UTL_SMTP to Send Email.
Regard
Helios

Similar Messages

  • ORA-29278: SMTP transient error: 421 Too many concurrent SMTP

    Hi Gurus,
    I'm send emails by using UTL_MAIL in oracle 10g but some time I got this error
    ORA-29278: SMTP transient error:
    421 Too many concurrent SMTP connections;
    please try again later
    my database detail are as under
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    please help to resolve this issue.
    Thanks in advance
    sadiq

    CREATE OR REPLACE PROCEDURE production_status_email
    AS
    v_sender VARCHAR2 (100) := '[email protected]';
    v_recipients VARCHAR2 (100) := '[email protected]';
    v_cc VARCHAR2 (200) := '[email protected]';
    v_date date default sysdate-1;
    v_subj VARCHAR2 (200) := 'Production Status of ' || to_date(v_date);
    l_mesg LONG := NULL;
    v_mtype VARCHAR2 (30) := 'text/html; charset=us-ascii';
    l_greetings LONG := NULL;
    l_table_heading LONG := NULL;
    l_table_data LONG := NULL;
    l_line_total LONG := NULL;
    l_line_bpcs LONG := NULL;
    l_table_footer LONG := NULL;
    l_regards LONG := NULL;
    n_row_counter NUMBER := 0;
    n_sr_counter NUMBER := 1;
    d_date DATE;
    n_sum_frozen_quantity NUMBER;
    n_sum_plan_quantity NUMBER;
    n_sum_achieve_quantity NUMBER;
    n_sum_price NUMBER;
    n_sum_b_pieces NUMBER;
    n_sum_b_price NUMBER;
    BEGIN
    l_greetings :=
    '<p>Dear sir,</p>'
    ||'<p>Following is Production Status of '
    || v_date
    || '</p>
    l_table_heading :=
    '<table border = "1" cellpadding="1" width="100%" >
    <tr bgcolor="CYAN"><font size="2" face="times" color="BLUE">
    <th align="LEFT" width="100">Main Resource</th>
    <th align="LEFT" width="150">Sub Resource</th>
    <th align="LEFT" width="60">UOM</th>
    <th align="RIGHT" width="100">Frozen Quantity</th>
    <th align="RIGHT" width="100">Plan Quantity</th>
    <th align="RIGHT" width="100">Acheived Quantity</th>
    <th align="RIGHT" width="100">Amount</th>
    <th align="LEFT">Reason</th></tr>';
    FOR mr IN (SELECT DISTINCT mrno, mresource
    FROM image.production_status_v
    WHERE pdate = TO_DATE (v_date)
    ORDER BY 1)
    LOOP
    l_table_data :=
    l_table_data
    || '<tr><font size="2" face="times"><th align="LEFT">'
    || mr.mresource
    || '</th>';
    n_sr_counter := 1;
    FOR sr IN (SELECT srno, sresource, uom, frozen_quantity, plan_quantity, achieve_quantity,price,
    remarks
    FROM image.production_status_v sr
    WHERE mresource = mr.mresource
    AND pdate = TO_DATE (v_date)
    ORDER BY srno)
    LOOP
    IF n_sr_counter > 1
    THEN
    l_table_data := l_table_data || '</font></tr>';
    l_table_data :=
    l_table_data || '<tr><font size="2" face="times"><td></td>';
    END IF;
    l_table_data :=
    l_table_data
    || '<td align="LEFT">'
    || sr.sresource
    || '</td>'
    || '<td align="LEFT">'
    || sr.uom
    || '</td>'
    || '<td align="RIGHT">'
    || TO_CHAR (sr.frozen_quantity, '99,999,999')
    || '</td>'
    || '<td align="RIGHT">'
    || TO_CHAR (sr.plan_quantity, '99,999,999')
    || '</td>'
    || '<td align="RIGHT">'
    || TO_CHAR (sr.achieve_quantity, '99,999,999')
    || '</td>'
    || '<td align="RIGHT">'
    || TO_CHAR (sr.price, '99,999,999')
    || '</td>'
    || '<td align="LEFT">'
    || sr.remarks
    || '</td>';
    n_sr_counter := n_sr_counter + 1;
    n_row_counter := n_row_counter + 1;
    END LOOP;
    l_table_data := l_table_data || '</font></tr>';
    IF n_sr_counter > 2
    THEN
    SELECT SUM (frozen_quantity)
    INTO n_sum_frozen_quantity
    FROM image.production_status_v
    WHERE mresource = mr.mresource AND pdate = TO_DATE (v_date);
    SELECT SUM (plan_quantity)
    INTO n_sum_plan_quantity
    FROM image.production_status_v
    WHERE mresource = mr.mresource AND pdate = TO_DATE (v_date);
    SELECT SUM (achieve_quantity)
    INTO n_sum_achieve_quantity
    FROM image.production_status_v
    WHERE mresource = mr.mresource AND pdate = TO_DATE (v_date);
    SELECT SUM (price)
    INTO n_sum_price
    FROM image.production_status_v
    WHERE mresource = mr.mresource AND pdate = TO_DATE (v_date);
    l_line_total :=
    '<tr bgcolor="#F0F0F0"><font size="2" face="times" color="BLUE">'
    || '<th align="RIGHT" colspan="3">Total</th>'
    || '<th align="RIGHT">'
    || TO_CHAR (n_sum_frozen_quantity, '99,999,999')
    || '</th><th align="RIGHT">'
    || TO_CHAR (n_sum_plan_quantity, '99,999,999')
    || '</th><th align="RIGHT">'
    || TO_CHAR (n_sum_achieve_quantity, '99,999,999')
    || '</th><th align="RIGHT">'
    || TO_CHAR (n_sum_price, '99,999,999')
    || '</th>
    </font></tr>';-- <td></td>
    l_table_data := l_table_data || l_line_total;
    END IF;
    IF mr.mresource = 'Stitching' then
    SELECT SUM(bqr)
    into n_sum_b_pieces
    from image.bundle2
    WHERE to_date(bqr_date) = TO_DATE (v_date);
    SELECT SUM(bqr * (SELECT ROUND (oe.price * er.rate)
    FROM orderent oe, ex_rate er
    WHERE oe.currency = er.currency
    AND oe.order# =
    SUBSTR (b2.order#, 1, 7)))
    into n_sum_b_price
    from image.bundle2 b2
    WHERE to_date(bqr_date) = TO_DATE (v_date);
    l_line_bpcs :=
    '<tr bgcolor="#F0F0F0"><font size="2" face="times" color="BLUE">'
    || '<th align="RIGHT" colspan="3">B Pieces</th>'
    || '<th align="RIGHT">'
    || ''
    || '</th><th align="RIGHT">'
    || ''
    || '</th><th align="RIGHT">'
    || TO_CHAR (n_sum_b_pieces, '99,999,999')
    || '</th><th align="RIGHT">'
    || TO_CHAR (n_sum_b_price, '99,999,999')
    || '</th>
    </font></tr>';-- <td></td>
    l_table_data := l_table_data || l_line_bpcs;
    END IF;
    END LOOP;
    l_table_footer := '</table>';
    --------------------------regards sectionstarts-
    l_regards :=
    '<p><font color="BLUE"><Address><br> Regards,<br> Information Systems
    </address></font>';
    -----------------------regards section ends;
    l_mesg :=
    l_mesg
    || l_greetings
    || l_table_heading
    || l_table_data
    || l_table_footer
    || l_regards;
    IF n_row_counter > 0
    THEN
    UTL_MAIL.send (v_sender,
    v_recipients,
    v_cc,
    NULL,
    v_subj,
    l_mesg,
    v_mtype,
    NULL
    END IF;
    END;
    /

  • ORA-29278: SMTP transient error: 401 4.1.7 Bad sender address syntax

    Hello All,
    I am Facing an Error as below while trying to Execute a Developed EMAIL Trigger in DB :
    ORA-29278: SMTP transient error: 401 4.1.7 Bad sender address syntax
    I am totally surprised as i have checked both the addresses : Sender as well as Receivers..
    My Senders Address is : '[email protected]'
    and Receivers Address is : '[email protected]'
    Any Help related to it will be highly appreciated..
    Regards,
    Deepak
    Below Script is being used :
    CREATE OR REPLACE PROCEDURE TESTMAIL(fromm VARCHAR2,too VARCHAR2,sub VARCHAR2,body VARCHAR2,port NUMBER)
    IS
    objConnection UTL_SMTP.CONNECTION;
    vrData VARCHAR2(32000);
    BEGIN
    objConnection := UTL_SMTP.OPEN_CONNECTION('mail.maxmsp.com',PORT);
    UTL_SMTP.HELO(objConnection, 'mail.maxmsp.com');
    UTL_SMTP.MAIL(objConnection, fromm);
    UTL_SMTP.RCPT(objConnection, too);
    UTL_SMTP.OPEN_DATA(objConnection);
    UTL_SMTP.WRITE_DATA(objConnection, 'From: '||fromm || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(objConnection, 'To: '||too || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(objConnection, 'Subject: ' || sub || UTL_tcp.CRLF);
    UTL_SMTP.WRITE_DATA(objConnection, 'MIME-Version: ' || '1.0' || UTL_tcp.CRLF);
    UTL_SMTP.WRITE_DATA(objConnection, 'Content-Type: ' || 'text/html;');
    UTL_SMTP.WRITE_DATA(objConnection, 'Content-Transfer-Encoding: ' || '"8Bit"' || UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF);
    UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'<HTML>');
    UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'<BODY>');
    UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'<FONT COLOR="red" FACE="Courier New">'||body||'</FONT>');
    UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'</BODY>');
    UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'</HTML>');
    UTL_SMTP.CLOSE_DATA(objConnection);
    UTL_SMTP.QUIT(objConnection);
    EXCEPTION
    WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
    UTL_SMTP.QUIT(objConnection);
    DBMS_OUTPUT.PUT_LINE(SQLERRM);
    WHEN OTHERS THEN
    UTL_SMTP.QUIT(objconnection);
    DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END TESTMAIL;
    DECLARE
    Vdate Varchar2(25);
    BEGIN
    Vdate := to_char(sysdate,'dd-mon-yyyy HH:MI:SS AM');
    TESTMAIL('[email protected]', '[email protected]', 'TESTMAIL','This is a UTL_SMTP-generated email at '|| Vdate,25);
    END;

    Hello Helios,
    I am trying the same script in the provided
    Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email. [ID 604763.1]
    Earlier it was reverting with Error :
    ORA-29278: SMTP transient error: 421 Service not available
    but after using the above Document ID we came to know that we are unable to TELNET mail server with Port 25
    Issue got solved but now its reverting with Error as below :
    ORA-29278: SMTP transient error: 401 4.1.7 Bad sender address syntax
    I then tried UTL_MAIL instead of UTL_SMTP as sugested by someone but it is also reverting with same Error.
    + I am using the same code as provided in document ID 604763.1 +
    Regards,
    Deepak Arora

  • ORA-29278: SMTP transient error: 421 Service not available

    Hi all,
    I'm using Oracle 10g working on Windows XP Home.
    I'm trying to send a basic mail from my stored procedure.
    When I tried to run the code, I get ORA-29278: SMTP transient error: 421 Service not available.
    Below is the code I'm trying.
    CREATE OR REPLACE PROCEDURE SEND_MAIL (
    msg_to varchar2,
    msg_subject varchar2,
    msg_text varchar2 )
    IS
    c utl_smtp.connection;
    rc integer;
    msg_from varchar2(50) := 'Oracle9.2';
    mailhost VARCHAR2(30) := '127.0.0.1'; -- local database host
    BEGIN
    c := utl_smtp.open_connection(mailhost, 25); -- SMTP on port 25
    dbms_output.put_line('ok');
    utl_smtp.helo(c, mailhost);
    utl_smtp.mail(c, msg_from);
    utl_smtp.rcpt(c, msg_to);
    utl_smtp.data(c,'From: Oracle Database' || utl_tcp.crlf ||
    'To: ' || msg_to || utl_tcp.crlf ||
    'Subject: ' || msg_subject ||
    utl_tcp.crlf || msg_text);
    utl_smtp.quit(c);
    EXCEPTION
    WHEN UTL_SMTP.INVALID_OPERATION THEN
    dbms_output.put_line(' Invalid Operation in Mail attempt using UTL_SMTP.');
    WHEN UTL_SMTP.TRANSIENT_ERROR THEN
    dbms_output.put_line(' Temporary e-mail issue - try again');
    dbms_output.put_line (sqlerrm);
    WHEN UTL_SMTP.PERMANENT_ERROR THEN
    dbms_output.put_line(' Permanent Error Encountered.');
    END;
    Below are the possibilites I tried..
    I tried to ping localhost.. This is the output I get
    C:\Documents and Settings\Me>ping localhost
    Pinging polasa [127.0.0.1] with 32 bytes of data:
    Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
    In one of the thread, a user suggested to do the following
    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.
    There is no IIS in my Windows Components..
    Any suggestions? Thanks in advance

    It sounds like you don't have an SMTP server running on your local machine.
    Even if you install IIS (or some other SMTP server), that is probably not enough to send email outside of your machine because your machine is unlikely to be trusted by the downstream mail servers. If you are running this in a company, you'll need to talk to your company's mail admin to determine where the corporate SMTP server is running. If you running this at home, you'll need to find out from your ISP what SMTP servers are available to you.
    Justin

  • ORA-29278: SMTP transient error:421 Service not available on oracle 10g

    HIi,
    I am trying to send e-mails by using PL/Sql procedure . I am using UTL_MAIL/UTL_SMTP on oracle 10g R1 database.
    There is no problem in creating procedure,but when i am doing execution i am getting the mention error.
    I am trying to send mail with attachment as excel file.
    ORA-20001: The following error has occured: ORA-29278: SMTP transient error:
    421 Service not available
    ORA-06512: at "SCOTT.MAIL_ATT_RAW", line 64
    ORA-06512: at line 1
    -----my procedure code------
    CREATE OR REPLACE PROCEDURE mail_att_raw(filename varchar2) AS
    fil BFILE;
    file_len PLS_INTEGER;
    MAX_LINE_WIDTH PLS_INTEGER := 54;
    buf RAW(2100);
    amt BINARY_INTEGER := 2000;
    pos PLS_INTEGER := 1; /* pointer for each piece */
    filepos PLS_INTEGER := 1; /* pointer for the file */
    filenm VARCHAR2(50) := filename; /* binary file attachment */
    data RAW(2100);
    chunks PLS_INTEGER;
    len PLS_INTEGER;
    modulo PLS_INTEGER;
    pieces PLS_INTEGER;
    err_num NUMBER;
    err_msg VARCHAR2(100);
    resultraw RAW(32000);
    BEGIN
    /* Assign the file a handle */
    fil := BFILENAME('BFILE_DIR', filenm);
    /* Get the length of the file in bytes */
    file_len := dbms_lob.getlength(fil);
    /* Get the remainer when we divide by amt */
    modulo := mod(file_len, amt);
    /* How many pieces? */
    pieces := trunc(file_len / amt);if (modulo <> 0) then
    pieces := pieces + 1;end if;/* Open the file */
    dbms_lob.fileopen(fil, dbms_lob.file_readonly);/* Read the first amt into the buffer */
    dbms_lob.read(fil, amt, filepos, buf);/* For each piece of the file . . . */
    FOR i IN 1..pieces LOOP/* Position file pointer for next read */
    filepos := i * amt + 1;/* Calculate remaining file length */
    file_len := file_len - amt;/* Stick the buffer contents into data */
    data := utl_raw.concat(data, buf);/* Calculate the number of chunks in this piece */
    chunks := trunc(utl_raw.length(data) / MAX_LINE_WIDTH);/* Don't want too many chunks */
    IF (i <> pieces) THEN
    chunks := chunks - 1;
    END IF;/* For each chunk in this piece . . . */
    FOR j IN 0..chunks LOOP/* Position ourselves in this piece */
    pos := j * MAX_LINE_WIDTH + 1;/* Is this the last chunk in this piece? */
    IF (j <> chunks) THEN len := MAX_LINE_WIDTH;
    ELSE
    len := utl_raw.length(data) - pos + 1;
    IF (len > MAX_LINE_width) THEN
    len := MAX_LINE_WIDTH;
    END IF;
    END IF;/* If we got something, let's write it */
    IF (len > 0 ) THEN
    resultraw := resultraw || utl_raw.substr(data, pos, len);
    END IF;
    END LOOP;/* Point at the rest of the data buffer */
    IF (pos + len <= utl_raw.length(data)) THEN
    data := utl_raw.substr(data, pos + len);
    ELSE
    data := NULL;
    END IF;/* We're running out of file, only get the rest of it */
    if (file_len < amt and file_len > 0) then
    amt := file_len;
    end if;/* Read the next amount into the buffer */dbms_lob.read(fil, amt, filepos, buf);
    END LOOP;/* Don't forget to close the file */
    dbms_lob.fileclose(fil);
    SYS.UTL_MAIL.SEND_ATTACH_RAW(sender => '[email protected]', recipients => '[email protected]',subject => 'Testmail', message => 'Hallo', attachment => resultraw, att_filename => filename);
    EXCEPTION
    WHEN OTHERS THEN--dbms_output.put_line('Fehler');
    raise_application_error(-20001,'The following error has occured: ' || sqlerrm);
    END;
    Please suggest me what settings i need to change. This same procedure is running on another maching,but not on my machine.
    If somebody is having any other simple procedure ,please help me.
    My SMTP port -25
    Thanks in advance.

    Hi Justin,
    Please get the answers of your queries
    The error you're getting is coming from the SMTP server you are trying to connect to.
    - What SMTP server is your database configured to use?
    Reply - I am using IIS(5.0)
    - What SMTP server is the database where this code is working configured to use?
    Reply - Same IIS. Database is installed locally on my machine only. I am trying to send mail locally to me only,Not to the outside person.
    - Has the SMTP server been configured to allow connections from both machines?
    Reply - Yes
    One more query, do we really require to set the SMTP_OUT_SERVER parameter for SCOPE=BOTH
    ALTER SYSTEM SET smtp_out_server = '172.16.1.10' SCOPE=BOTH
    I am not able to set like this for BOTH,only for SPFILE i can set ?.
    My SMTP Server IP=172.16.1.10
    PORT- 25
    Thanks
    Manoj

  • How can I solve ORA-29278: SMTP transient error: 421 Service not available

    Hi
    I have two different Solaris Server (Server1 & server2).
    In both the server SMTP server is configured.
    In these two solaris server (Server1 & server2) we have installed Oracle 9i
    I am using client machine to execute the following procedure.
    When I connect to server1 (using SQL plus) and execute the following procedure, it works fine, and able to send emails properly.
    But when I connect to server2 (using SQL plus) and execute the following procedure, I get the follwoing error.
    Could you please help me to resolve this?
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    SQL> set define off
    SQL> set serveroutput on size 1000000
    SQL> BEGIN
    2 mail_files( 'localhost',
    3 'Frm',
    4 '[email protected]',
    5 'From production',
    6 'Test message from production',
    7 9999999999,
    8 NULL,
    9 NULL,
    10 NULL,
    11 0 );
    12 END;
    13 /
    BEGIN
    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 327
    ORA-06512: at "PROD_L.MAIL_FILES", line 238
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at line 2
    SQL>

    Hi
    I have two different Solaris Server (Server1 & server2).
    In both the server SMTP server is configured.
    In these two solaris server (Server1 & server2) we have installed Oracle 9i
    I am using client machine to execute the following procedure.
    When I connect to server1 (using SQL plus) and execute the following procedure, it works fine, and able to send emails properly.
    But when I connect to server2 (using SQL plus) and execute the following procedure, I get the follwoing error.
    Could you please help me to resolve this?
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    SQL> set define off
    SQL> set serveroutput on size 1000000
    SQL> BEGIN
    2 mail_files( 'localhost',
    3 'Frm',
    4 '[email protected]',
    5 'From production',
    6 'Test message from production',
    7 9999999999,
    8 NULL,
    9 NULL,
    10 NULL,
    11 0 );
    12 END;
    13 /
    BEGIN
    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 327
    ORA-06512: at "PROD_L.MAIL_FILES", line 238
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at line 2
    SQL>

  • UTL_SMTP with Sendmail: Solution for ORA-29278: SMTP transient error

    For those of you migrating from Windows or other platforms to Linux (Redhat Enterprise AS 3.0, in my case) and have email routines using UTL_SMTP, I have a hard-earned hint for you. If your email routines are not working when you try to use the local smtp service (sendmail) try the following at the SQL prompt.
    set serverout on
    declare
    c utl_smtp.connection;
    r utl_smtp.reply;
    begin
    c := utl_smtp.open_connection('local.email.server', 25);
    utl_smtp.helo(c,'local.email.server');
    end;
    If you get ORA-29278: SMTP transient error: 421 Service not available, try the following instead:
    set serverout on
    declare
    c utl_smtp.connection;
    r utl_smtp.reply;
    begin
    c := utl_smtp.open_connection('127.0.0.1', 25);
    utl_smtp.helo(c,'127.0.0.1');
    end;
    And you should get success. So you should specify the internal loopback IP address for the email hostname in the open_connection function. It will not work with anything else (servername, localhost, NIC IP).
    The reason for this is that there is a setting in the sendmail config file (/etc/mail/sendmail.mc) that causes sendmail to only listen on 127.0.0.1. As long as you aren't using sendmail as a relay, this isn't a problem.
    Just specify 127.0.0.1 for the email hostname in the open_connection function.
    Hope this helps someone.
    Trenton

    Hi;
    What is DB version?
    Please see:
    From Master Note For PL/SQL UTL_SMTP and UTL_MAIL Packages [ID 1137673.1] check Note 604763.1 "ORA-29278: SMTP transient error: 421 Service not available" When Using UTL_SMTP to Send Email.
    Regard
    Helios

  • ORA-29278: SMTP transient error - Need Help

    I am getting below error from my code block though i am not calling UTL_SMTP package.
    It is confusing to me and I am not getting how to debug this.
    Please help me.
    My Orable DB Version - Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    Error Message
    ERROR: -29278 ORA-29278: SMTP transient error: 421 Service not
    available
    ORA-06512: at "SYS.UTL_SMTP", line 20
    ORA-06512: at "SYS.UTL_SMTP",
    line 96
    ORA-06512: at "SYS.UTL_SMTP", line 138
    ORA-06512: at "W_ADM_DW.DW
    PL/SQL procedure successfully completed.
    {code}
    *Pseudo-code  of my code block*
    {code}
    VARIABLE Ret number
    set serveroutput on size 20000
    show serveroutput
    DECLARE
    --Local variable declaration
    BEGIN
         select count(*)
         into v_count
         from <Table_Name>
         where   <Column_Name>=<YYYYMM>;
         if v_count > 0 then
            SELECT PARTITION_NAME
            INTO v_partition_name
            FROM ALL_TAB_PARTITIONS
            WHERE TABLE_NAME='<Table_Name>'
            AND INSTR(PARTITION_NAME,<YYYYMM>,1,1)<>0;
             v_sql := utl_particion.truncate_partition('&3','<Table_Name>', v_partition_name);
                if v_sql!=0 then
                     raise_application_error(-20088,'Error in Truncate partition');
                    :Ret := 2;
                end if;
            commit;
         end if;
          v_sql:='alter session enable resumable timeout 72000 name ''<Table_Name>''';
          execute immediate v_sql;
          v_sql := '       INSERT /*+ APPEND*/ INTO '<Table_Name>'';
          v_sql := v_sql || ' (  <column_name1>, ';
          v_sql := v_sql || '    <column_name2>, ';
          v_sql := v_sql || '    <column_name3>, ';
          v_sql := v_sql || '    <column_name4>, ';           
          v_sql := v_sql || ' ) ';
          v_sql := v_sql || ' SELECT /*+ PARALLEL(<Source_Table_Name>,6)*/';
          v_sql := v_sql || '        <column_name1>, ';
          v_sql := v_sql || '        <column_name2>, ';
          v_sql := v_sql || '        <column_name3>, ';
          v_sql := v_sql || '        <column_name4>, ';         
          v_sql := v_sql || '     FROM <Source_Table_Name> WHERE <column_name> BETWEEN ' || v_frm_date || ' AND ' || v_to_date;
          execute immediate v_sql;
             v_total:=SQL%ROWCOUNT;          
          commit;
    EXCEPTION
        WHEN OTHERS THEN
          ROLLBACK;
          dbms_output.put_line ('ERROR: '|| SQLCODE || ' ' || substr(SQLERRM,1,200));
           :Ret := 2;
    END;
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thanks for identifying utl_particionpackage. I tried to check the code of this package, but it has wrapped, so i cannot see the code.
    But one thing i have observed - If utl_particion.truncate_partition internally calling UTL_SMTP package and I am getting error from this package then this will catch by below code -
             v_sql := utl_particion.truncate_partition('&3','<Table_Name>', v_partition_name);
                if v_sql!=0 then
                     raise_application_error(-20088,'Error in Truncate partition');
                    :Ret := 2;
                end if;and after that it will catch by user define error exception block (This i did not mention in my earlier post)
        WHEN excepcion_ctrl THEN
            dbms_output.put_line (WRN: '|| substr(SQLERRM,4,200));
            :Ret:=0;But it has catch by when others exception -
    I think inside utl_particion.truncate_partition procedure has proper exception handling. So when some error will occur it will return '0'. If there is no proper exception handling then we can assume the error will propagate to When Others Exception block.
    Please tell me my understanding is correct or not.

  • Bug? htmldb_util.reset_pw gives ORA-29278: SMTP transient error 451

    After changing mailprovider we had some troubles mailing from the database.
    After mailing to his SMTP-server we got the error message:
    ORA-29278: SMTP transient error: 451
    We were able to correct our custom code by replacing all the end-of-line LF with calls to
    UTL_TCP.CRLF.
    However, our Apex-application is still broken. By calling HTMLDB_UTIL.RESET_PW
    the system should mail the new pwd to our user.
    Should
    But it doesn't
    In the Mail Log/queue we again get the ORA-29278,
    so my deduction is that in the message that RESET_PW assembles a single LF is
    used and not the CRLF.
    Question: is there a way to overcome this bug?
    BTW, the SMTP-server is present. Writing a HTMLDB_MAIL.SEND by hand gives no trouble at all.

    CRLF characters are required to separate each SMTP command, per RFC 821 (http://www.ietf.org/rfc/rfc0821.txt), and that is what the APEX_MAIL package does.
    But the portion that "you are afraid of" which contains CHR(10) is the message[b] body of the reset password functionality of APEX - there can be any combination of characters in there. It is not a requirement that the body of the message uses CRLF for line endings. So, unfortunately, I don't think the deduction applies here.
    Let's start with some basic things. If you change the "SMTP Host Address" in the internal Administration Services of APEX to a known good SMTP host, does the problem go away?
    451 means "Requested action aborted: error in processing". That could be anything. It could even be an issue with your provider, your connection to the provider, etc. Does your provider have a log of the incoming "conversation" and a log of the abort? That may be helpful.
    Joel
    P.S. By the way, which version of Application Express/HTML DB are you using?

  • Sending mail - ORA-29278: SMTP transient error: 421 Service not available

    Hi everybody,
    I am trying to send mail using
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    But getting the error as mentioned in the title.
    I searched the forum and find so many threads.
    But not sure what to do.
    Can anyone help me,please?
    Thanks,
    jeneesh

    Hi
    Send you the code we use.
    PROCEDURE send_email (from_name varchar2,to_name varchar2,subject varchar2,message varchar2,max_size number default 9999999999,file_name varchar2 default null) is
    v_smtp_server varchar2(100) := your_smtp_server;
    v_smtp_server_port number := 25;
    v_directory_name varchar2(100);
    v_file_name varchar2(100);
    v_line varchar2(1000);
    crlf varchar2(2):= chr(13) || chr(10);
    mesg varchar2(32767);
    conn UTL_SMTP.CONNECTION;
    v_slash_pos number;
    v_file_handle utl_file.file_type;
    invalid_path exception;
    begin
    conn:= utl_smtp.open_connection( v_smtp_server, v_smtp_server_port );
    utl_smtp.helo( conn, v_smtp_server );
    utl_smtp.mail( conn, from_name );
    utl_smtp.rcpt( conn, to_name );
    utl_smtp.open_data ( conn );
    mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
    'From: ' || from_name || crlf ||
    'Subject: ' || subject || crlf ||
    'To: ' || to_name || crlf ||
    'Mime-Version: 1.0' || crlf ||
    'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"' ||
    crlf ||
    '' || crlf ||
    '--DMW.Boundary.605592468' || crlf ||
    'Content-Type: text/plain; name="message.txt"; charset=US-ASCII' ||
    crlf ||
    'Content-Disposition: inline; filename="message.txt"' || crlf ||
    'Content-Transfer-Encoding: 7bit' || crlf ||
    '' || crlf ||
    message || crlf ;
    utl_smtp.write_data ( conn, mesg );
    if file_name is not null then
              begin
                        v_slash_pos := instr(file_name, '/', -1 );
                        if v_slash_pos = 0 then
                                  v_slash_pos := instr(file_name, '\', -1 );
                        end if;
                        v_directory_name := substr(file_name, 1, v_slash_pos - 1 );
                        v_file_name := substr(file_name, v_slash_pos + 1 );
                        v_file_handle := utl_file.fopen(v_directory_name, v_file_name, 'r');
                        mesg := crlf || '--DMW.Boundary.605592468' || crlf ||
                        'Content-Type: application/octet-stream; name="' || v_file_name ||
                        '"' || crlf ||
                        'Content-Disposition: attachment; filename="' || v_file_name ||
                        '"' || crlf ||
                        'Content-Transfer-Encoding: 7bit' || crlf || crlf ;
                        utl_smtp.write_data ( conn, mesg );
                        loop
                                  utl_file.get_line(v_file_handle, v_line);
                                  mesg := v_line || crlf;
                                  utl_smtp.write_data ( conn, mesg );
                        end loop;
                        exception
                             when utl_file.invalid_path then
                             dbms_output.put_line('Error in opening attachment ' || file_name);
                             when others then
                             null;
              end;
    end if;
    mesg := crlf || '--DMW.Boundary.605592468--' || crlf;
    utl_smtp.close_data( conn );
    utl_smtp.quit( conn );
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line(sqlerrm);
    dbms_output.put_line(sqlcode);
    end;
    Hope it helps u

  • ORA-29278: SMTP transient error:421 Service not available error?-V.Urgent

    Hi All,
    I am trying to use utl_smtp for sending mails.
    1. I am not able to set SMTP_OUT_SERVER for scope =Both,i can use only SPFILE, Why?
    alter system set smtp_out_server = '<ip-address:port' scope=Both;
    my server ip address 172.16.1.10 and port-25
    2. I am using oracle 10g Rel1 database.
    3. I am using UTL_MAIL.SEND_ATTACH_RAW procedure for sending mail with attachment.
    Please help me as i tried so many things but no luck.
    This is very urgent.
    Thanks in Advance.

    Urgent is it?
    What makes you believe that your request for help is more important than someone else who has requested help? It's very rude to assume you are more important than somebody else, and I'm sure they would like an answer to their issue as soon as they can get one too, but they've generally been polite and not demanded that it is urgent.
    Also, you assume that people giving answers are all sitting here just waiting to answer your question for you. That's not so. We're all volunteers with our own jobs to do. How dare you presume to demand our attention with urgency.
    If you want help and you want it answering quickly you simply just put your issue forward and provide as much valuable information as possible.
    You will find if you post on here demanding your post is urgent then most people will just ignore it, some will tell you to get lost, and some will explain to you why you shouldn't post "urgent" requests. Occasionally you may find somebody who's got nothing better to do who will actually provide you with an answer, but you really are limiting your options by not asking properly.
    Looking at your question:
    1. I am not able to set SMTP_OUT_SERVER for scope =Both,i can use only SPFILE, Why?Why indeed? What problem are you actually having? Is it giving you an error? If so, what is the error?

  • UTL_SMTP fails:  SMTP transient error: 421 Service not available

    Hi!
    I´m trying to set up database to be able to send emails by UTL_SMTP package.
    I´m working whit Oracle 9.0.2.0.7 on Windows 2003 Server EE SP1
    For this, I have searched a script of the many on the network. One like this:
    CREATE OR REPLACE PROCEDURE CASIUS.SEND_MAIL(SENDER IN VARCHAR2, RECIPIENT IN VARCHAR2, SUBJECT IN VARCHAR2, MESSAGE IN VARCHAR2) IS
        MAILHOST CONSTANT VARCHAR2(3000) := 'server.exchange.test.com';
        MESG VARCHAR2(30000);
        MAIL_CONN UTL_SMTP.CONNECTION;
        BEGIN
            UTL_SMTP.QUIT(MAIL_CONN);
            MAIL_CONN := UTL_SMTP.OPEN_CONNECTION(MAILHOST, 25);
            UTL_SMTP.EHLO(MAIL_CONN, MAILHOST); 
            UTL_SMTP.COMMAND( MAIL_CONN, 'AUTH', 'LOGIN ');        
            UTL_SMTP.COMMAND( MAIL_CONN, UTL_RAW.CAST_TO_VARCHAR2( UTL_ENCODE.BASE64_ENCODE( UTL_RAW.CAST_TO_RAW( '[email protected]' ))));
            UTL_SMTP.COMMAND( MAIL_CONN, UTL_RAW.CAST_TO_VARCHAR2( UTL_ENCODE.BASE64_ENCODE( UTL_RAW.CAST_TO_RAW( 'testpassw')))); 
            MESG := 'Date: ' ||
            TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || CHR(13) || CHR(10) ||
            'From: <'|| SENDER ||'>' || CHR(13) || CHR(10) ||
            'Subject: '|| SUBJECT || CHR(13) || CHR(10)||
            'To: <'||RECIPIENT || '>' || CHR(13) || CHR(10) || MESSAGE;
            UTL_SMTP.EHLO(MAIL_CONN, MAILHOST);
            UTL_SMTP.MAIL(MAIL_CONN, SENDER);
            UTL_SMTP.RCPT(MAIL_CONN, RECIPIENT);
            UTL_SMTP.DATA(MAIL_CONN,MESG);
            UTL_SMTP.QUIT(MAIL_CONN);
        EXCEPTION
            WHEN OTHERS THEN
            RAISE_APPLICATION_ERROR(-20004,SQLERRM);
    END SEND_MAIL;
    I've reviewed the script many times and I find no error. But when I call it I always have this error:
    ORA-20004: ORA-29278: SMTP transient error: 421 Service not available
    I have done many tests. Although the most meaningful test that I have done may be the send of a message via telnet  from the same server using the same parameters. It has worked!. This is the log:
    220 server.exchange.test.com ESMTP Service ready
    AUTH LOGIN
    334 VXNad23hsdj2bWU6
    bm90aWZpY2FjaW9uZMSA12smVsQHNvcG9ydGUtc21zLmVz
    334 UGFzer24cmQ6
    TDRdE3p6NA==
    235 LOGIN authentication successful
    MAIL FROM:<[email protected]>
    250 MAIL FROM:<[email protected]> OK
    RCPT TO: <[email protected]>
    250 RCPT TO:<[email protected]> OK
    DATA
    354 Start mail input; end with <CRLF>.<CRLF>
    From:Yomismo
    TO:Mimismo
    Subject: Test Send Emails
    This is a send test
    250 <522DCAD000D5FF89> Mail accepted
    QUIT
    221 server.exchange.test.com QUIT
    Connection to host lost.
    This test email was received for me, so I think is evidenced that the problem is in ULT_SMTP package.
    And more specifically, I suspect that the exception raises on one of these lines:
            UTL_SMTP.QUIT(MAIL_CONN);
            MAIL_CONN := UTL_SMTP.OPEN_CONNECTION(MAILHOST, 25);
    But I don´t understand why, All the sites I have viewed uses package of similar way...
    Can someone throw me some light on this issue?
    Regards

    maybe you find something in https://community.oracle.com/message/3560073. And I would recommend to think about upgrading to a current Oracle version, since 9.2 has been desupported around 2007.

  • ORA-12012: error on auto execute of job 754461 ORA-29279: SMTP permanent error: ORA-29279: SMTP permanent error: 501 Syntax error, parameters in command "RCPT TO:" unrecognized or missing ORA-06512: at "SYS.UTL_SMTP", line 20 ORA-06512: at "SYS.UTL_SMTP",

    Hi ,
    I am getting below error frequently in alert log of database.
    ORA-12012: error on auto execute of job 754461
    ORA-29279: SMTP permanent error: ORA-29279: SMTP permanent error: 501 Syntax error, parameters in command "RCPT TO:" unrecognized or missing
    ORA-06512: at "SYS.UTL_SMTP", line 20
    ORA-06512: at "SYS.UTL_SMTP", line 98
    ORA-06512: at "SYS.UTL_SMTP", line 240
    ORA-06512: at "APPS.EIS_UTIL_PKG", line 94
    ORA-06512: at "APPS.HKD_PO_ADDON_PKG", line 110
    ORA-06512: at line 1

    You have a job running in the database. Its job ID is 754461
    It looks as if that job runs APPS.HKD_PO_ADDON_PKG
    That job is attempting to send mail using UTL_SMTP and apparently passing some strange value to SMTP server for the RCPT TO: parameter.

  • UTL.MAIL error ORA-29279: SMTP permanent error: 501 Address Syntax Error in

    Hi,
    I am new to the forum so please excuse if I post incorrectly without conforming to the standards.
    We need to send mails using the UTL.MAIL package and have installed them on the database.
    Whenever I am trying to send an email I am getting the following error:
    ERROR at line 1:
    ORA-29279: SMTP permanent error: 501 Address Syntax Error in
    [email protected]
    ORA-06512: at "SYS.UTL_MAIL", line 654
    ORA-06512: at "SYS.UTL_MAIL", line 671
    ORA-06512: at line 2
    The test code which I am running is as follows:
    BEGIN
    UTL_MAIL.send(sender => 'test <[email protected]>',
    recipients => '[email protected]',
    subject => 'UTL_MAIL test subject',
    message => 'UTL_MAIL test body');
    END;
    I have tried different combinations:
    BEGIN
    UTL_MAIL.send(sender => 'test "<[email protected]>"',
    recipients => '[email protected]',
    subject => 'UTL_MAIL test subject',
    message => 'UTL_MAIL test body');
    END;
    even tried
    BEGIN
    UTL_MAIL.send(sender => '[email protected]',
    recipients => '[email protected]',
    subject => 'UTL_MAIL test subject',
    message => 'UTL_MAIL test body');
    END;
    Everytime I am getting the same error.
    This seems to be working with an exchange mail server but never on the SMTP server.
    In the SMTP server logs the sender address is not having the angular brackets <> unlike the other mails which are being sent over.
    It seems that the SMTP server is pretty strict and the SMTP admin will not change any settings on the server.
    The oracle version is as follows
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    Could you please help me out with a solution.
    Some how the angular brackets are geting stripped off (which UTL MAIL package generally does), Is there any way in which I can include the angular brackets.
    Edited by: 984757 on 29-Jan-2013 02:56
    Edited by: 984757 on 29-Jan-2013 02:57

    I dislike UTL_MAIL - clunky and poor abstraction interface, and not well written.
    Had a look at the code. It does this:
    WHILE (ALL_RCPTS IS NOT NULL) LOOP
          UTL_SMTP.RCPT(MAIL_CONN,'&lt;' || GET_ADDRESS(ALL_RCPTS) || '&gt;');
    END LOOP;The GET_ADDRESS() function process the ALL_RCPTS parameter, returns the 1st address from it, and updates the (in/out) parameter with the remaining string.
    SQL> var address varchar2(200);
    SQL> exec :address := '<[email protected]>,[email protected]';
    PL/SQL procedure successfully completed.
    SQL> exec dbms_output.put_line( 'get_address='||UTL_MAIL.GET_ADDRESS(:address)||' address='||:address );
    get_address=[email protected] address=[email protected]
    PL/SQL procedure successfully completed.
    SQL> exec dbms_output.put_line( 'get_address='||UTL_MAIL.GET_ADDRESS(:address)||' address='||:address );
    get_address=[email protected] address=
    PL/SQL procedure successfully completed.
    SQL> The address is explicitly surrounded by brackets as per the RFC. So that is what your SMTP server should see.
    If not - perhaps then our UTL_MAIL versions do not match. Cannot recall from what version I pulled and unwrapped the UTL_MAIL package code I have.
    Personally though, I've ceased using UTL_MAIL a while back. It lacks in may respects. I have written my own mail package that supports multiple attachment, complex Mime formatting, attachments of 20+ MB in size, and so on - running on the UTL_SMTP interface (that provides the transport layer for sending mail). And for issues like you are facing, I suggest considering using UTL_SMTP directly.
    Edited by: Billy Verreynne on Jan 29, 2013 12:52 PM
    (Updated the code with HTML entity names to get the code snippet to render correctly)

  • SMTP service not available

    Hi,
    How to send mail through the following code ?
    CREATE OR REPLACE PROCEDURE send_mail (p_to IN VARCHAR2,
    p_from IN VARCHAR2,
    p_message IN VARCHAR2,
    p_smtp_host IN VARCHAR2,
    p_smtp_port IN NUMBER DEFAULT 25)
    AS
    l_mail_conn sys.UTL_SMTP.connection;
    BEGIN
    l_mail_conn := sys.UTL_SMTP.open_connection(p_smtp_host, p_smtp_port);
    sys.UTL_SMTP.helo(l_mail_conn, p_smtp_host);
    sys.UTL_SMTP.mail(l_mail_conn, p_from);
    sys.UTL_SMTP.rcpt(l_mail_conn, p_to);
    sys.UTL_SMTP.data(l_mail_conn, p_message || UTL_TCP.crlf || UTL_TCP.crlf);
    sys.UTL_SMTP.quit(l_mail_conn);
    END;
    BEGIN
    send_mail(p_to => '[email protected]',
    p_from => '[email protected]',
    p_message => 'This is a test message.',
    p_smtp_host => 'mail.google.com');
    END;
    ERROR:
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at "SYS.UTL_SMTP", line 20
    ORA-06512: at "SYS.UTL_SMTP", line 96
    ORA-06512: at "SYS.UTL_SMTP", line 138
    ORA-06512: at "APPS.SEND_MAIL", line 9
    ORA-06512: at line 2
    Please help me to get through the error.
    Thanks in advance ,
    Pradeep
    Edited by: user11165897 on Dec 7, 2012 2:27 AM

    Hi,
    here all the input values are wrong.
    By providing correct host, email, port it is working fine now..
    pradeep

Maybe you are looking for