This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes set return path in MimeMessage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "set return path in MimeMessage" Watch "set return path in MimeMessage" New topic

set return path in MimeMessage

Jilani Jidni

Joined: Feb 06, 2007
Posts: 8
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.setSubject("Test Mail");
message.setContent(messageText, "text/html");
((JavaMailSenderImpl) mailSender).send(message);

please tell me what I am doing wrong.

Thanking you
Golam Jilani Jidni

With Regards<br /> Jilani Jidni<br /> Bangladesh
Rubel Ahammad

Joined: Feb 05, 2005
Posts: 19
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.


Hope this will help.

rubel ahammad<br /> <br />SCJP 1.4 (91%)<br />SCWCD 1.4 (Preparing)
Jilani Jidni

Joined: Feb 06, 2007
Posts: 8
Dear Rubel,

Thanks for your reply.
I agree. Here's the link:
subject: set return path in MimeMessage
Similar Threads
how to detect a firewall
JavaMail application not making use of all the servers behind the smtp smarthost
problem sending mail with spring javamailsender
Suppressing Applet alerts when using mail API
Sending email from java. Pls Help!!!