Set MAIL FROM (Return-Path:) without setting Sender: header in email
Posted on 2009-12-17
I am writing a .NET application that will send out thousands of email notifications (no, not spam) on behalf of our clients. I am (currently) planning on sending these through an Exchange server, and that requires NTLM authentication, so I have chosen System.Net.Mail.SmtpClient as my class.
In order to track the bounces for our client, I need to ensure that the Return-Path: header reflects our email address, (while of course the From: header reflects our client's address). This is done by setting the MailMessage.Sender property. The problem is, in addition to using that as the MAIL FROM, it also adds a "Sender:" header to the email. The side-effect of this Sender: header is that now the email reads as "From: <venderemail> ON BEHALF OF <clientemail>". This of course is not what the client wants. The email should appear to come from them.
I know that this can legitimately be done, because I've tested it using telnet and constructing my own message. I just need a .NET class to do it so it can handle the NTLM authentication and mime encoding, etc..
If possible I don't want to have to purchase a third party piece of software, and as I've stated I would also like to avoid writing my own SMTP client.