Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

set return path in MimeMessage

 
Jilani Jidni
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I was send mail by using javax.mail.internet.MimeMessage vi send mail. And its working. But when a email is bounce like email address is invalid then the bounce email aren't store into INBOX. May be its happening for setHeader return-path. I am trying to set it but its not working. Here is my code:

MimeMessage message = ((JavaMailSenderImpl) mailSender).createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, false);
helper.addTo("jidni@yahoo.com");
helper.setFrom(jidni@hotmail.com);
helper.setSubject("Test Mail");
message.setHeader("return-Path","test@testmail.local");
message.setContent(messageText, "text/html");
((JavaMailSenderImpl) mailSender).send(message);

please tell me what I am doing wrong.

Thanking you
Golam Jilani Jidni
 
Rubel Ahammad
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Jidni,
I was also facing similar kind of problem. But at last i was able to track bounced mails by setting "mail.smtp.from" property to the desired email address.

As far as I know, You dont need to set reply path header to track bounced mail.

i.e.


Hope this will help.
thanks
 
Jilani Jidni
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Rubel,

Thanks for your reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic