In +{message:id=2382999}+ Joel suggests using the following format for <tt>p_to</tt> and <tt>p_from</tt> parameters in <tt>apex_mail.send</tt> to generate literal To/From email headers.
begin
/*
Of course "invalid" is not used...
*/
apex_mail.send(
p_to => '"Foobar"<foo@bar.com.invalid>',
p_from => '"Baz"<baz@bar.com.invalid>',
p_subj => 'RFC 821',
p_body => 'This is a problem');
end;
This works on a development box when the APEX SMTP Host is set to <tt>localhost</tt> on port 25 (and I have no idea what SMTP software is servicing this). However when the customer's Lotus Domino mail server is hooked in to comply with their email policies, it fails with
ORA-29279: SMTP permanent error: 501 Syntax error, parameters in command "RCPT TO:"Foobar"<foo@bar.com.invalid>" unrecognized or missing
The project has a definite requirement for the From header to present with different display information when sent from different environments (although the underlying email address will be the same). We'd prefer to use <tt>apex_mail</tt> to get logging and easy HTML formatting, but it looks like there's no possibility of meeting the displayed From header requirements using the combination of <tt>apex_mail</tt> and Lotus Domino SMTP server. Unless anyone knows different, we'll have to abandon <tt>apex_mail</tt> and implement something using <tt>utl_smtp</tt> where we've got more granular control to use RFC 821/5321-compliant <tt>MAIL FROM/RCPT TO</tt> and separate To/From <tt>DATA</tt> headers with the relevant display information?
APEX 3.0.0.00.20
Oracle 10.2.0.3 EE