6 Replies Latest reply on Mar 14, 2012 3:44 PM by rp0428

    error in UTL_SMTP.rcpt command

    user10685034
      Hi,

      I am using UTL_SMTP.rcpt commnd to send mail to multiple user but its getting error when v_email_id_1 string length exceeds 500 .

      UTL_SMTP.rcpt(v_l_mail_conn, v_email_id_1);

      v_l_mail_conn := UTL_SMTP.connection;
      v_email_id_1:= is a varchar2 field which contain list of people to whom we have to send mail.

      Please suggest some other option or root cause of the error ?

      Thanks in advance.
        • 1. Re: error in UTL_SMTP.rcpt command
          Etbin
          http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/u_smtp.htm#i1002798 says

          RCPT Function

          This subprogram specifies the recipient of an e-mail message.

          To send a message to multiple recipients, call this routine multiple times. Each invocation schedules delivery to a single e-mail address. ...

          Regards

          Etbin
          • 2. Re: error in UTL_SMTP.rcpt command
            >
            I am using UTL_SMTP.rcpt commnd to send mail to multiple user
            >
            No you are not. rcpt sends to one user

            See the RCPT Functin Usage Notes in the PL/SQL Packages and Types Doc
            http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/u_smtp.htm#i1002798

            >
            Usage Notes

            To send a message to multiple recipients, call this routine multiple times. Each invocation schedules delivery to a single e-mail address.
            >
            Dang Etbin beat me by a hair again.

            Edited by: rp0428 on Mar 13, 2012 11:22 PM
            • 3. Re: error in UTL_SMTP.rcpt command
              user10685034
              Hi,
              Thanks for your reply .

              I have stored comma separated email id in v_email_id_1 variable
              like
              v_email_id_1 := 'abc@rediffmail.com,frg@gmail.com'

              It works when v_email_id_1 string length is less than 500 .

              we want one mail at a time to all customer.

              Please suggest how to do or how to remove this error ?
              • 4. Re: error in UTL_SMTP.rcpt command
                >
                Please suggest how to do or how to remove this error ?
                >
                You do it just like the doc says.
                >
                To send a message to multiple recipients, call this routine multiple times. Each invocation schedules delivery to a single e-mail address.
                • 5. Re: error in UTL_SMTP.rcpt command
                  user10685034
                  Please send me doc link. because mentioned link only for sending single mail id to signle person .not multiple person
                  • 6. Re: error in UTL_SMTP.rcpt command
                    >
                    Please send me doc link. because mentioned link only for sending single mail id to signle person .not multiple person
                    >
                    And that brings us full circle.

                    You have the doc link above for 11g. There is only one UTLL_SMTP package and only one RCPT method. It is for sending to a single recipient.
                    The length of the command line in total cannot be over 512 characters as stated in the Rules and Limits section near the start of the doc

                    >
                    command line
                    Maximum total length of a command line including the command word and the <CRLF> is 512 characters
                    >
                    You need to use multiple calls to the RCPT method. Each call needs to be shorter than ~500 characters. There is no other solution.