0

First of all, Greetings!

I am about to Develop a a custom newsletter application in Java using the Javax.mail API. So I need to Develop a Verp technique in order to track bounces.

So far I have Override the javax.mail.internet.MimeMessage Just to handle my own Mail headers.

class CustomMailMessage extends MimeMessage
...
public void setCustomHeader(key, value)
{
    setHeader(key, value);
    updateHeaders();
}
...

So this seems to work with any header that I set except the Return-Path.

...
setCustomHeader("Return-Path",verpAddr);
...

Resulting a VERP failure. I have track the value of this header just before and after I call

...
Transport.send(message);
...

and it seems that the value is the same as I have set it. Yet, at the received mail the return-path is changed to the sender address (From:). unlike the rest of the headers are as they were set. And so the bounce notification is delivered to the sender rather than my bounce+usermail=host@mydomain.com .

I think that this failure is on postfix site.

Note that the server is set by Plesk, and my domain.com is shared on my server.

So I please anyone that may assist me. Or can provide me more info on how to achieve differently a Verp technique.

Thx in Advance & Cheers!

1 Answers1

2

The Return-Path header is set by the receiver, not the sender.

You want to set the "envelope from" address. See the javadocs for the com.sun.mail.smtp package for the property to set, and see the SMTPMessage class as another way to set this information.

Note also that you don't need to subclass MimeMessage just to set custom headers. You can call the setHeader method directly and updateHeaders will be called before the message is sent. (And updateHeaders won't do anything with these custom headers anyway.)

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40