Before You Begin
This 15-minute tutorial demonstrates how to call an email template to send out email notifications for upcoming milestones in Sample Projects application.
This is the second tutorial in the series Oracle Application Express 18: Email Templates. Read the tutorials in the following sequence:
- Oracle Application Express 18: Email Templates (1 of 2) - Configure the Template
- Oracle Application Express 18: Email Templates (2 of 2) - Call the Template
Background
In the previous tutorial, you installed the Sample Projects application and created an email template. In this tutorial, you create a procedure to call the email template and add a button and process to call the procedure.
What Do You Need?
To complete this tutorial you need to:
- Complete the preceding tutorial in this series.
Create
a Procedure Using the apex_mail.send API
To create a procedure using the apex_mail.send
API:
- On the Workspace home page, click SQL Workshop.
- Click SQL Commands.
- In SQL Commands, copy and paste the code in send_milestone_reminder.txt.
Description of the illustration create_procedure.png - Click Run. The following message displays
below the Results tab:
Procedure Created
. - Click the App Builder menu at the top of the page. The App Builder home page appears.
Add a
Button to the Milestones Page
To add a button:
- On the App Builder home page, select the Sample Projects application.
- On the Application home page, find and select 6, Milestones. Page Designer appears.
- From the Gallery at the bottom of page:
- Select the Buttons tab.
- Right-click Text with Icon [Hot]. From
the context menu, select Add To, Breadrumbs,
and then Create.
Description of the illustration create_button.png - In the Property Editor, update:
- Identification: Button Name
- Enter
Email
- Identification: Label -
Enter
Email Reminder
- Click Save.
A new button appears in Page Designer.

Create
a Process to Call the Procedure
To create a process :
- In the left pane, select the Processing
tab.
Description of the illustration processing_tab.png - Select Processing. Select the Processing
Menu and then select Create Process.
Description of the illustration create_process.png A process called New appears under Processes and attributes display in the Property Editor (right pane).
Description of the illustration new_process.png - In the Property Editor, edit the following:
- Identification: Name -
Enter
Email Reminder
- Source: PL/SQL Code -
Enter:
begin SEND_MILESTONE_REMINDER; end;
- Success Message: Success Message
- Enter:
Emails sent to all Project Leads with Milestones due in the next two weeks
- Success Message: Error Message
- Enter:
Error sending emails
- Click Save.
Update
Team Member with Valid Email Address
When you installed Sample Projects, the installation process automatically created a Team Member that matches your workspace username. Before you can test the new Email Reminder button, you need update that Team Member to include a valid email address.
To add a valid email address:
- Click Run and Save Page.
Description of the illustration pg6_save_and_run.png - If a Sign dialog appears, enter your workspace username and
password and click Log In. The Milestones
page appears.
Description of the illustration milestones_pg.png" - In the left navigation menu, select Team Members. The Team Members page appears.
- On the Team Members page, find and select the username which
matches your workspace username. Look for the Profile, I'm
the one who ran this data script to populate these demo
tables. In the following example, the user is Admin.
Description of the illustration edit_user.png - In the Maintain Team Member dialog:
- In Email, enter a valid email address.
Description of the illustration maintain_team_member.png - Click Apply Changes.
The new email address displays on the Team Members page.
- In the left navigation menu, select Milestones. The Milestones page appears.
Test
the Button
To test the button:
- On the Milestones page, note the Email Reminder
button in the upper right corner above the report.
Description of the illustration test_button.png - Click the Email Reminder button.
The following Success appears:
Emails sent to all Project Leads with Milestones due in the next two weeks
Description of the illustration success_message.png - Check the email account tied to your workspace user. You should receive an email for all active projects.
This ends the second and final tutorial in this series.