MailMessage, the difference between Sender and From properties

I have used the System.Net namespace since we switched from the .NET Framework 1.1 to the 3.5 framework, but on the one hand, it puzzled me. What is the difference between the Sender and From properties in the MailMessage class?

They are both the same, and if not, is there a reason to use Sender with From ?

For example:

 Using m As New System.Net.Mail.MailMessage() m.Sender = New System.Net.Mail.MailAddress("test@test.com", "Name here") m.From = New System.Net.Mail.MailAddress("test@test.com", "Name here") m.Subject = "Test" m.Body = "Test" Dim client As New System.Net.Mail.SmtpClient("mymailserver.com") client.Send(m) End Using 
+71
Apr 19 '10 at 15:35
source share
2 answers

Email excerpt from the wiki:

Header Fields: The message header must contain at least the following fields:

From: Email address and, if necessary, the name of the author (s). Many email clients do not change, except by using account settings.

Also note that the From: field does not have to be the actual sender of the email message. One of the reasons is that it’s very easy to fake the From: field and give a message, it seems, from any mailing address. It is possible to digitally sign e-mail, which is much more difficult to fake, but such signatures require additional programming and often external programs for verification. Some Internet service providers do not relay emails stating that it comes from a domain not hosted by them, but there is very little (if any) verification to make sure that the person or even the email address specified in the From: field is connected with connection. Some ISPs use email authentication systems to send email through their MTAs so that other MTAs can detect fake spam that may appear to them.

Sender: Address of the actual sender acting on behalf of the author specified in the From: field (secretary, list manager, etc.).

Details on http://en.wikipedia.org/wiki/Email

For example, gmail uses the from / sender fields to send emails from different email addresses than your gmail account (after verification).

+56
Apr 19 '10 at 15:43
source share

I found this explanation pretty easy to understand (emphasis mine).

One area in which there are quite a few operations is in the concept of From email address and Email sender.

Some mail servers will accept the From address as the sender, and some will output Sender automatically, and some require Sender to specify explicitly.

In general, the sender is the actual source of the email message. In contrast to this From address, it is simply a header line in a letter that may or may not be meant to mean anything. From addresses can often be left completely. Spammers can easily spoof From Address. Internet service providers are trying to ensure that spammers cannot cheat the Sender.

+23
Sep 26 '12 at 18:01
source share



All Articles