Translate

Montag, 10. September 2018

APEX 4.2, 5.1, 18,2 - send email from an APEX application

again and again the question is asked: how to send an email from an APEX application ?

sorry - english, because this is an answer to a question in the APEX community forum.

I answered:

1: Pls kindly read the user guide...:
https://docs.oracle.com/database/apex-18.1/HTMDB/sending-email-from-an-application.htm#HTMDB13006

(The whole functionality is based on the APEX_MAIL API)

2. in short:

A) from within a page/form - add procedure of type "Send_email" and use substitutions/placeholders like  &P1_NAME. or  &P1_EMAIL. in the UI properties... - this is one email as per page/data





























B) loop thru records of a table and send emails to those records like: - this is: several emails in a row....

  1. FOR m IN (SELECT VORNAME, NACHNAME, EMAIL  
  2.             FROM TABLE  
  3. Where email is not null  
  4.           and status = 'Aktiv'  
  5. and ABTEILUNG like '%'||:P3_ABTEILUNG  
  6.           )  
  7. LOOP  
  8.   apex_mail.send( p_to => m.EMAIL,  
  9.                   p_from => 'info@my_email.de',  
  10.                   p_bcc => 'info2@my_2nd_email.com',  
  11.                   p_body => 'Hallo '||m.vorname||','||chr(10)||chr(10)||:P3_TEXT||chr(10)||  
  12.                 :P3_SIGNATURE                 
  13.                 ,  
  14.                   p_subj => :P3_SUBJECT  
  15.                 );  
  16. end loop;  

:P3_TEXT, :P3_SIGNATURE, :P3_SUBJECT and :P3_ABTEILUNG are names of fields in page 3 - in SQL and pl/sql these types of substitutions are used... in the Procedure re A) "Send_email" UI we use substitutions of type: &P3_NAME.


Keine Kommentare:

Kommentar veröffentlichen