How can I specify where bounce messages should go, if I don't want them to come back to the from/replyTO field?

Ellen Spertus

Bounce messages (and other errors) are sent to the SMTP FROM (also called ENVELOPE FROM) attribute, not the MESSAGE FROM attribute, which is what is set with Message.setFrom(). You can set the SMTP FROM as follows:

Properties props = System.getProperties();
props.put("mail.smtp.from", "");
If you do not provide a value for SMTP FROM, the MESSAGE FROM value is used.

See also Sun's JavaMail FAQ.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact