14.1.07

Mail from Application Express again

I used a beta version of Oracle XE. The DMBS_EPG gateway did not work at all. So I decided to reinstall Oracle XE (production). After reading a post on the Application Express (APEX) forum I recreated my sendmail application from scratch. Everything went fine, except the litte detail of sending email did not work anymore. My first solution was to adjust the smtp hostname in the package body but still no mail.

Have look at the comments in the package specification of htmldb_mail.

--
--
-- Parameters p_smtp_hostname and p_smtp_portno remain for backward
-- compatibility. But they are ignored. The SMTP host name and
-- parameter are exclusively derived from system preferences
-- when sending mail.
--
procedure push_queue( p_smtp_hostname in varchar2 default null,
p_smtp_portno in varchar2 default null );

The SMTP hostname and portnumber are ignored while calling push_queue. The real settings are derived from system preferences.

I have never heard of system preferences before, people always talk about database parameters. And because htmldb_mail depends on utl_smtp, I thought that the startup parameter smtp_out_server did not have the correct value. In fact, the parameter value was null and after setting it to the correct value, the mail was still not sent.

It took a while surfing to find the system preferences. You can check these preferences as follows.
SELECT wwv_flow_platform.get_preference('SMTP_HOST_ADDRESS') FROM dual
/
SELECT wwv_flow_platform.get_preference('SMTP_HOST_PORT')FROM dual
/
In APEX you can set these preferences in the main menu of application builder and choose the task email configuration.
The following screen appears:


You can set the smtp hostname and portnumber in the email preferences. Or you can manage the mail queue (the mail queue is like the outbox in your mail client) or you can manage the email log. When an item is sent, the header data is moved from the queue into the log.

Finally, the sendmail application works fine.

No comments: