Link to home
Start Free TrialLog in
Avatar of N1njaB0b
N1njaB0bFlag for United States of America

asked on

Set MAIL FROM (Return-Path:) without setting Sender: header in email

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.
Avatar of bhagwantsingh
bhagwantsingh
Flag of India image

Did you try System.Net.Mail.MailMessage.ReplyTo and System.Net.Mail.MailMessage.Sender property?
Avatar of N1njaB0b

ASKER

The .ReplyTo property does not set the MAIL FROM.  The .Sender property does set the MAIL FROM, but unfortunately also sets the Sender: header, which I do not want.
ASKER CERTIFIED SOLUTION
Avatar of N1njaB0b
N1njaB0b
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial