Running the 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: < 50730865.2152b40a.13ea.28ec@mx.google.com > 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" value specified in the code. The recipient application may be misleading two, and the rest will look as expected. Some email clients present From + Sender (when they are different) as "sent by the sender on behalf of From."
You may be worried about the fact that Google Mail still displays the account with which the email is sent through the Sender field, but this is how it works. You are submitting this account.
And another possible reason is the From email address. If you added it to your Google Mail account as one of your own addresses (and confirmed using a test message via the link), then Google Mail will allow you to place it in the From field. Otherwise, he may discard it and replace it with Sender .
Roman R.
source share