Janning Vygen opened SPR-16443 and commented
When you use a MimeMessageHelper you can't set the "envelope from" only by setting a property "mail.smtp.from" for the java mail session. But this property affects every mail. It makes sense to set an variable envelope return path (VERP) for every message to process bounces.
com.sun.mail.smtp.SMTPMessage extends MimeMessage and is supporting setEnvelopeFrom which overrides "mail.smtp.from".
At the moment you can achieve this only by building a new MimeMessage
MimeMessageHelper helper;
SMTPMessage smtpMessage = new SMTPMessage(helper.getMimeMessage());
smtpMessage.setEnvelopeFrom(verpAddress)
javaMailSender.send(smtpMessage)
It would be quite easy to use SMTPMessage instead of MimeMessage
Affects: 5.0.3
Reference URL: http://cephas.net/blog/2006/06/09/using-apache-james-and-javamail-to-implement-variable-envelope-return-paths/
Comment From: jhoeller
Since the SMTPMessage
class is not part of the standard JavaMail / Jakarta Mail API, I'm afraid we'll have to leave its usage up to the application.