5 Replies Latest reply: Dec 28, 2012 10:35 AM by Gor_Mahia RSS

    how to create email page in Apex

    Gor_Mahia
      All,
      I want to create email page but the email process type within Apex seems to be having some limitation i want to have multiple receivers/recipients, attachments etc. What is the best and most preferred approach? i searched "Application Express Builder User Guide" talking about customizing APEX_MAIL but explanation is not detailed enough,

      Apex 4.1.1/Oracle 11g2


      any help...thanks.
        • 1. Re: how to create email page in Apex
          VC
          Gor_Mahia wrote:
          All,
          I want to create email page but the email process type within Apex seems to be having some limitation i want to have multiple receivers/recipients, attachments etc. What is the best and most preferred approach? i searched "Application Express Builder User Guide" talking about customizing APEX_MAIL but explanation is not detailed enough,

          Apex 4.1.1/Oracle 11g2


          any help...thanks.
          Where did you come across about that limitation? There is no such limitation in built-in send email process and you can send it to multiple recipients with multiple attachments.

          When you are creating the send email page process please click on labels to get more help and this is what it says:

          - To field
          Valid email address to which the email will be sent. 
          For multiple email addresses, use a comma-separated list. Use substitution syntax if you want to use a dynamic value.
          
          Examples
          
              john.doe@test.com, jane.doe@test.com
              John Doe <john.doe@test.com>, Jane Doe <jane.doe@test.com>
              &P6_TO.
          - Attachment SQL field
           SQL statement which returns one or more BLOBs which get attached as files to the e-mail.
          The SQL statement has to be in the following format:
          
          select blob_column, file_name, mime_type from table
          
          The column mime_type is optional.
          Alternatively you can also create a pls/sql process manually to do the same invoking the APEX_MAIL API
          • 2. Re: how to create email page in Apex
            Gor_Mahia
            VC,
            Will do asap and close if possible. Thanks again for such helpful suggestion.
            • 3. Re: how to create email page in Apex
              Gor_Mahia
              VC,
              I instead decided to use custom mail send process as below. I did some test and it works great but at times it throws the below error,

              ORA-29279: SMTP permanent error: 503 5.0.0 Need RCPT (recipient)

              but i know for sure the recipient emails are all correct, any idea what could be wrong here ?

              DECLARE
              v_subject VARCHAR2(100);
              v_sender VARCHAR2(100);
              v_recipient VARCHAR2(100);
              v_cc VARCHAR2(100);
              v_bcc VARCHAR2(100);
              v_body VARCHAR2(4000);
              v_body_html VARCHAR2(4000);
              vEmail varchar2(100);

              BEGIN
              vEmail := :Pxxx_TO_MAIL;
              v_subject := :Pxxx_SUBJECT;
              v_sender := :Pxxx_EMAIL;
              v_recipient := vEmail;
              v_cc := '';
              v_bcc := '';

              v_body := :Pxxx_TEXT;
              v_body_html := 'welcome to the world.';

              APEX_MAIL.SEND(
              P_TO => v_recipient,
              P_FROM => v_sender,
              P_CC => v_cc,
              P_BCC => v_bcc,
              P_BODY => v_body,
              P_SUBJ => v_subject);
              END;


              thank you,
              • 4. Re: how to create email page in Apex
                Prabodh
                Hi,
                ORA-29279: SMTP permanent error: 503 5.0.0 Need RCPT (recipient)
                You will get this error then the v_recipient is null in this line
                P_TO => v_recipient,
                Cheers,
                • 5. Re: how to create email page in Apex
                  Gor_Mahia
                  Prabodh
                  That was helpful but i resolved it the format of the emails wasnt right...thanks.