I used the following piece of code and it works fine:
props.put("mail.smtp.from", "xyz@123.com");
Session session = Session.getDefaultInstance( props, null );
MimeMessage message = new MimeMessage( session );
message.addFrom(InternetAddress.parse("abc@123.com"));
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:
https://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?