Return-Path different from Sender (Mail Component)

0 votes
asked Mar 22, 2012 by sudhakargorti (150 points)
edited Mar 23, 2012

Hello,

I understand that if I need to have the Return-Path set (where the emails will bounce), I need to set the Sender address. But setting the Sender address shows "on behalf of" in Outlook. I want to avoid that and just sent the Return-Path in the header without setting the Sender property. Is it possible in Rebex' email components?

Thanks, Sudhakar

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Mar 22, 2012 by Tomas Knopp (58,890 points)
edited Mar 23, 2012
 
Best answer

Hello

it is possible. You have to manually specify the sender in the Smtp's Send(mail, sender, recipients) method, not in the message.

The Return-Path is added to the message by the recipient's SMTP server.

Please try this code:

        MailMessage mail = new MailMessage();
        mail.Subject = "...";
        mail.BodyText = "...";
        mail.From = "..."; //real sender
        mail.To = "...";
        ...
        Smtp smtp = new Smtp();
        smtp.Connect("server", port);
            ...
        smtp.Send(mail, "sender - return path", null); //address for bouncing

Does it work for you?

commented Mar 23, 2012 by sudhakargorti (150 points)
edited Mar 23, 2012

Yes, it works! Thanks so much.

Sudhakar.

...