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

Posted on 2009-12-17
Medium Priority
Last Modified: 2013-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.
Question by:N1njaB0b
  • 2

Expert Comment

ID: 26077686
Did you try System.Net.Mail.MailMessage.ReplyTo and System.Net.Mail.MailMessage.Sender property?

Author Comment

ID: 26080154
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.

Accepted Solution

N1njaB0b earned 0 total points
ID: 26171732
I have determined that this cannot be done using the built-in System.Net.Mail.SmtpClient class.  If anybody is interested, I ended up using third-party Chilkat software.

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question