The Email_template consists of 2 parts:
Part 1) The template details
divided into:
- header
- body
- footer
with HTML code content.
By means of a smart click (right hand side region) using "Sample Templates"
--> Get started by loading sample email Templates...
- you can load the HTML code data for the generation of an invoice... :
The hashtags like #CUSTOMER_NAME# are substitions we know from other places within APEX.
Once we have defined the Email_template and adjusted the HTML for formatting we like to use it.... How ?
Part 2) pl/sql procedure
On the template_details page (as above) we will find a TAB called: "Sample API Usage" which shows the pl/sql we have to use to map the fields from a page to the hashtag substitions:
begin apex_mail.send ( p_to => email_address_of_user, p_template_static_id => 'EXAMPLE01', p_placeholders => '{' || ' "CUSTOMER_NAME":' || apex_json.stringify( :P1_CUST_NAME ) || ' ,"ITEMS_ORDERED":' || apex_json.stringify( :P1_ITEMS_ORD ) || ' ,"MY_APPLICATION_LINK":' || apex_json.stringify( some_value ) || ' ,"ORDER_DATE":' || apex_json.stringify( some_value ) || ' ,"ORDER_NUMBER":' || apex_json.stringify( some_value ) || ' ,"ORDER_TOTAL":' || apex_json.stringify( some_value ) || ' ,"ORDER_URL":' || apex_json.stringify( some_value ) || ' ,"SHIPPING_ADDRESS_LINE_1":' || apex_json.stringify( some_value ) || ' ,"SHIPPING_ADDRESS_LINE_2":' || apex_json.stringify( some_value ) || ' ,"SHIP_TO":' || apex_json.stringify( some_value ) || '}' ); end;You just have to apply your fields from the page to "some_value".... as above.
So on your page you have to create a region of type pl/sql and insert above code... Create a Button and run the process by means of clicking the button.
The output is an HTML formatted email.
I did it even in way: The customer enters his data and clicks on "CREATE" (order or s.th.) and the data is stored in the database AND in parallel an order confirmation - email is sent to the customer.
that's it!
I did it even in way: The customer enters his data and clicks on "CREATE" (order or s.th.) and the data is stored in the database AND in parallel an order confirmation - email is sent to the customer.
that's it!
Keine Kommentare:
Kommentar veröffentlichen