File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

set return path in MimeMessage

 
Jilani Jidni
Greenhorn
Posts: 8
  • 0
  • 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
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Rubel,

Thanks for your reply.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic