SMTP can accepts emails with false sender name

好久不见. 提交于 2020-01-07 02:41:25

问题


I'm using SMTPClient for sending emails to a SMTP server. But with Send method I can specify any false sender name or email. How can I prevent this?


回答1:


It's the job of your mail server to decide on what it accepts as a sender email address - that's just a matter of policy.

There is no 'true' email address for a mail client, so nothing that can be enforced at the client.




回答2:


I think that should be the SMTP server's role to decide whether a sender name is valid or not. In fact, introducing it in your code is a violation of the DRY rule since you'd be replicating the SMTP configuration.

As you can see in http://msdn.microsoft.com/en-us/library/swas0fwc%28v=VS.90%29.aspx, you should only be prepared to catch SmtpExceptions and properly display them to your software's user.




回答3:


You can't do anything about it in the SmtpClient.

You can do something about it in your application. Send a verification email that the user must click on to validate it's email.

You can do something about it in your smtp server. Check the MX record or the defined SPF policies against the sender domain/ip address.




回答4:


SMTP is a mail transfert protocol (as the name implies). It's not in charge of authenticating the sender. To authenticate the sender, your need to use certificates, which SMTP supports, but again, just as a mean of transfert. The program itself needs to have the logic to authenticate the sender with the certificate.

You can also use authentication, but in that case it'll be the SMTP server that will match the username/password with an email address.



来源:https://stackoverflow.com/questions/4142664/smtp-can-accepts-emails-with-false-sender-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!