MailMessage,发件人之间从性质差异 [英] MailMessage, difference between Sender and From properties

查看:407
本文介绍了MailMessage,发件人之间从性质差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 System.Net 命名空间自从我们从.NET Framework 1.1中切换到3.5框架,但有大局;一件事,大局;被因为我百思不得其解。什么是发件人中的属性 MailMessage 类?

难道他们两个是相同的,如果不是有没有理由使用发件人

例如:

 以间作为新System.Net.Mail.MailMessage()
    m.Sender =新System.Net.Mail.MailAddress(test@test.com,在这里名称)
    m.From =新System.Net.Mail.MailAddress(test@test.com,在这里名称)

    m.Subject =测试
    m.Body =测试

    昏暗的客户端作为新System.Net.Mail.SmtpClient(mymailserver.com)
    client.Send(米)
结束使用
 

解决方案

从电子邮件维基摘录:

头字段: 消息头应至少包括以下字段:

发件人:电子邮件地址,以及可选的作者(S)的名称。在许多电子邮件客户端无法更改,除非通过更改帐户设置。

另外请注意,来自:字段不必须是电子邮件消息的发送者真正。其中一个原因是,这是很容易伪造发件人:字段,让信息似乎是来自任何邮件地址。它可以进行数字签名的电子邮件,这是更难伪造的,但这样的签名需要额外的编程和经常外部程序来验证。一些ISP不转发电子邮件,声称来自不由他们主持的领域,但很少(如果有的话)检查,以确保在被点名的人,甚至电子邮件地址发件人:字段是一个与连接相关联。一些ISP申请的电子邮件身份验证系统,以电子邮件正在通过自己的MTA发送到让其他MTA检测到可能出现来自这些伪造的垃圾邮件。

发件人:实际发件人的地址代表的中列出的作者来自:场(秘书,列表管理等)

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

详细

例如Gmail使用了从/发件人域发送不同的电子邮件不会忽略的邮件不是您的Gmail帐户(验证后)。

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

解决方案

Excerpt from the wiki on email:

Header fields: The message header should include at least the following fields:

From: The e-mail address, and optionally the name of the author(s). In many e-mail clients not changeable except through changing account settings.

Also note that the "From:" field does not have to be the real sender of the e-mail message. One reason is that it is very easy to fake the "From:" field and let a message seem to be from any mail address. It is possible to digitally sign e-mail, which is much harder to fake, but such signatures require extra programming and often external programs to verify. Some ISPs do not relay e-mail claiming to come from a domain not hosted by them, but very few (if any) check to make sure that the person or even e-mail address named in the "From:" field is the one associated with the connection. Some ISPs apply e-mail authentication systems to e-mail being sent through their MTA to allow other MTAs to detect forged spam that might appear to come from them.

Sender: Address of the actual sender acting on behalf of the author listed 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 adresses than your gmail account (After verification).

这篇关于MailMessage,发件人之间从性质差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆