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

Posted on 2009-12-17
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
    LVL 5

    Expert Comment

    Did you try System.Net.Mail.MailMessage.ReplyTo and System.Net.Mail.MailMessage.Sender property?
    LVL 1

    Author Comment

    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.
    LVL 1

    Accepted Solution

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now