0 votes
by (910 points)
edited

For an auto responder, I need to set the Return-Path header field of an outgoing message to an empty address ("Return-Path: <>"). If I add this as a custom header, it seems to be replaced when the message is sent. Also, according to the RFC, the Return-Path header field should be the first one in the header, but in my case it is somewhere in the middle.

How can I achieve this?

Applies to: Rebex Secure Mail

4 Answers

0 votes
by (58.9k points)
edited
 
Best answer

Please see the this forum answer. Just one difference - if you want to set an empty bouncing address i.e. "<>", you will have to enable the AllowNullSender property like this:

Smtp smtp = new Smtp();
smtp.Settings.AllowNullSender = true;
smtp.Connect("server", port);

smtp.Send(mail, "<>", null); //address for bouncing is empty
smtp.Disconnect();

Is it working for you now?

0 votes
by (910 points)
edited

Hard to tell. The e-mails I get back by POP3 all have valid return paths, in case of googlemail both the empty one and a valid one, in case of our own mail server just a valid one. So I can't tell if that's being added by the server/your component or if it's already there when receiving the mail on the server :-(

That's exactly the same result as when just adding a return path header myself and using smtp.Send(mail).

Any way to log what's actually being sent in .eml form or something?

Edit: I checked on our mail server, and the valid return path is there, too, so it's not due to POP3 downloading. So question is if it's being correctly sent and the return path is added by the mail server, or if a valid return path is being sent.

0 votes
by (58.9k points)
edited

Well, the Return-Path header is added by the Recipient's SMTP server. You can log what is being sent by the Rebex SMTP component using the LogWriter property. However, if you create the log you will see that the component correctly announces the empty sender:

2014-07-17 14:23:56.450 INFO Smtp(1)[8] Command: MAIL FROM:<> SIZE=250

and this should be translated into an empty Return-Path header by the recipient's SMTP server. However, I guess that some of the SMTP servers out there in the wild might not accept the empty sender <> and replace it with the sender address specified in one of the EML headers. Unfortunately, this seems to be out of the reach of Rebex SMTP component.

0 votes
by (910 points)
edited

Yes, I think so, too. I will go with the proposed solution, since everything else seems out of our/your control. Thanks!

...