Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Location
    Montreal,Canada
    Posts
    1

    Unanswered: Problem getting the correct reply code from SMTP server using UTL_SMTP package

    Hi ,

    We are using UTL_SMTP package for sending email from Oracle 8.1.7.4
    database(please see the procedure below).

    The problem is to get the error code after testing for syntactically valid mail address.

    We have tried utl_smtp.vrfy which is always returns the code 252 for
    correct or wrong email address which is a result code not an error code, and utl_smtp.rcpt which is always returns 250 either for correct or wrong email address (never 550 for wrong address).

    Any help will be much appreciated.

    Alex

    CREATE OR REPLACE PROCEDURE Meds_Send_Mail
    ( sender IN VARCHAR2,
    recipient IN VARCHAR2,
    cc_recipient IN VARCHAR2 ,
    bcc_recipient IN VARCHAR2 ,
    subject IN VARCHAR2,
    message_body IN LONG,
    mailhost IN VARCHAR2 ,
    return_code OUT NUMBER -- returns SMTP reply code
    )
    IS
    mail_conn utl_smtp.connection;
    crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
    mesg LONG ; -- VARCHAR2( 1000 );
    v_mail_reply utl_smtp.reply;
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
    'From: <'||sender||'>' || crlf ||
    'Subject: '||subject || crlf ||
    'To: '||recipient || crlf ||
    'CC: '||cc_recipient || crlf ||
    'BCC: '||bcc_recipient || crlf ||
    '' || crlf || message_body;
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, sender);
    v_mail_reply := utl_smtp.rcpt(mail_conn, recipient);
    -- v_mail_reply := utl_smtp.vrfy(mail_conn, recipient);

    return_code := v_mail_reply.code ;
    IF v_mail_reply.code <> 550
    THEN
    utl_smtp.rcpt(mail_conn, recipient);
    utl_smtp.data(mail_conn, mesg);
    utl_smtp.quit(mail_conn);
    return_code := 0 ;
    ELSE
    return_code := v_mail_reply.code ;
    END IF ;
    END;
    /

  2. #2
    Join Date
    Sep 2003
    Posts
    1
    Not all servers support verification, and those that do may support it in different ways. An email server, for example, may choose to defer validation until the list of recipients is complete; the specification requires that there be no unreasonable delay in processing incoming messages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •