2 Replies Latest reply: Jul 30, 2013 4:03 AM by SachinGurarikar RSS

    UTL_SMTP use in getting invalid email ID

    SachinGurarikar

      Hello All,

      I am trying to use UTL_SMTP pkg to send the mails.

      Everything is working fine with one exception. I am not able to find which email deliveries are failed due to invalide email address.

      Script which I am using is...

       

      +++++

      DECLARE

              l_mail_conn UTL_SMTP.connection

              ;

              l_vrfy_msg  UTL_SMTP.REPLY

              ;

      BEGIN

              l_mail_conn := UTL_SMTP.open_connection ('mailhost', 25)

              ;

              utl_smtp.helo(l_mail_conn, 'mailhost')

              ;

              l_vrfy_msg := utl_smtp.vrfy(l_mail_conn, 'sachingurharikar@gmail.com')

              ;

              IF l_vrfy_msg.code = 550

              THEN

                  DBMS_OUTPUT.PUT_LINE('email address Not found ...'||l_vrfy_msg.code

                                         )

                  ;

                  RAISE_APPLICATION_ERROR (-20001,'Invalid sender address')

                  ;

              END IF

              ;

      EXCEPTION

              WHEN others

              THEN

                   DBMS_OUTPUT.PUT_LINE(SQLERRM)

                   ;

      END

      ;

      +++++

       

      I also tried using  utl_smtp.rcpt but fail to get the expected output.

       

      Yours help is appreciated in resolving this.

       

      Thanks,

      Sachin Gurarikar