2 Replies Latest reply: Aug 8, 2013 9:04 AM by Oracle_Gal RSS

    How to add field or query in TO field of Send E-Mail Page process

    Oracle_Gal

      Hi Everyone,

      Can you please help me?

      How can I add field or query in "TO" field of Send E-Mail Page process?

      I'm using Application Express 4.1.0.00.32 and oracle 10g.

        • 1. Re: How to add field or query in TO field of Send E-Mail Page process
          jwellsnh

          Hi User11131067, please update your handle via you profile to something more personal.

           

          Here is how I did it:

          DECLARE

             l_body   CLOB;

             l_to     VARCHAR2 (255);

          BEGIN

             l_body :=

                   'Thank you for your interest in the APEX_MAIL package.'

                || UTL_TCP.crlf

                || UTL_TCP.crlf;

             l_body := l_body || '  Sincerely,' || UTL_TCP.crlf;

             l_body := l_body || '  The APEX Dev Team' || UTL_TCP.crlf;

           

           

             -- Get email addresses of Harvest Item Administrators

             WITH admins

                  AS (SELECT person_tbl.email_address_txt,

                             ROW_NUMBER () OVER (ORDER BY email_address_txt) rn,

                             COUNT (*) OVER () cnt

                        FROM harvest_admin_tbl, person_tbl

                       WHERE     harvest_admin_tbl.active_ind = 'Y' -- Use active Admins only

                             -- Eliminate Admin taking action

                             AND harvest_admin_tbl.internal_employee_id <> v_payroll_id

                             AND harvest_admin_tbl.internal_employee_id =

                                    person_tbl.employee_ghrs_id)

                 -- Concatenate email addresses into one string

                 SELECT LTRIM (SYS_CONNECT_BY_PATH (email_address_txt, ','), ',') catvalues

                   INTO l_to

                   FROM admins

                  WHERE rn = cnt

             START WITH rn = 1

             CONNECT BY PRIOR rn = rn - 1;

           

           

             apex_mail.send (p_to     => 'some_user@somewhere.com', -- change to your email address

                             p_from   => l_to,

                             p_body   => l_body,

                             p_subj   => 'APEX_MAIL Package - Plain Text message');

          END;

          /