How to use any email address in the FROM field while sending email through Gmail SMTP?

I employ the very same to send email using GMail as a service. I originally set the .From property to "[email protected]" but the email still arrives with the From header set to the account used to authenticate.

Faced with this problem, I used the ReplyToList property (.ReplyToList.Add(MailAddress))) so that recipients that reply to the message will be sending the reply to an email account other than the "automated" one that we use to send outgoing messages.

Edit:

For more information, see this thread on Google Groups. Also, a related answer on Stack Overflow.


Having run your code snippet I get:

Return-Path: <my user>
Received: from Psi ([80.92.234.64])
        by mx.google.com with ESMTPS id f1sm20531634wiy.2.2012.10.08.10.07.49
        (version=TLSv1/SSLv3 cipher=OTHER);
        Mon, 08 Oct 2012 10:07:49 -0700 (PDT)
Message-ID: <[email protected]>
Sender: Roman R. <my user>
MIME-Version: 1.0
From: any email
To: my email
Date: Mon, 08 Oct 2012 10:07:49 -0700 (PDT)
Subject: Subject
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

Body

Sender is the email address used to authenticate with Google Mail. From is the "from" provided in code. The receiving application might be confusing the two, and the rest looks just as expected. Some mail clients present the From+Sender (when they are different) as "sent by Sender on behalf of From".

You might be concerned with the fact that Google Mail still reveal the account from which the email is sent, through Sender field, but this is how it works. You do send from this account.

And, another possible reason is the From mail address itself. If you added it to your Google Mail account as one of your own addresses (and confirmed via test email with a link), then Google Mail will allow putting it onto From field. Otherwise it might drop it and replace it with the Sender.