I've been using the System.Net
namespace ever since we switched from .NET Framework 1.1 to the 3.5 framework, but there’s one thing that’s been puzzling me since. What's the difference between the Sender
and the From
properties in the MailMessage
class?
Are they both the same, and if not is there a reason to use Sender
together 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
See Question&Answers more detail:os