I have just started using Javamail V 1.4. I would like to implement the following functionality: Send an email FROM a mail address but redirect the bounce back emails to another mail address that is different from the FROM address. Eg: Send an email with FROM address as email@example.com but set the 'Return-Path' to another email address, say firstname.lastname@example.org.
I am using message.setHeader("Return-Path", "email@example.com") to accomplish this. But it does not seem to work. Could you please help me with the right code to be used?
I went through Javamail API and found that if the property "mail.smtp.from" is not set, then the FROM address is selected by default as return address. If the property is set to another mail id, all the bounce backs are redirected to the other id! This works perfectly fine....Thanks to the suggestion provided at the following link: http://www.coderanch.com/t/273916/java/java/set-return-path-MimeMessage
But, I have another question now: Is it possible to set 'mail.smtp.from' property to more than one mail addresses so that bounce backs are redirected to multiple addresses? If so, how can I do this?
Hasn't anyone read my post? Because this is exactly where the Reply-To address is for - and you can set an entire array of addresses too.
Joined: Sep 29, 2007
Sorry for overlooking your message!
Actually I tried using void javax.mail.internet.MimeMessage.setReplyTo(Address arg0).
But it doesnot redirect the bounce back emails to firstname.lastname@example.org. Instead when I click on 'Reply' button in the mail I receive, the Reply-To is set to this address(email@example.com) rather than the FROM address (firstname.lastname@example.org).