1&1 虚拟主机和 smtp 配置
有人尝试过使用 1&1 smtp 主机发送电子邮件吗?我尝试了以下?
SmtpClient mailClient = new SmtpClient("smtp.1and1.com", 587);
mailClient.Credentials = new NetworkCredential("[email protected]", "password");
但它总是给我一个安全豁免错误...
我尝试使用本地主机,它工作正常。我尝试使用 gmail 的 smtp,它也工作正常。它说我需要进行身份验证才能使用smtp 服务器,我通过查看上面的代码来做到这一点...这是确切的错误:
安全异常
描述:已尝试应用程序 执行不允许的操作 安全政策。为了授予此 申请所需的权限 请联系您的系统 管理员或更改 应用程序的信任级别 配置文件。
异常详细信息: 系统.安全.安全异常: 请求类型许可 'System.Net.Mail.SmtpPermission, 系统,版本=2.0.0.0, 文化=中立, 公钥令牌=b77a5c561934e089' 失败。
Has anyone ever tried sending emails using 1&1 smtp host? I tried the following?
SmtpClient mailClient = new SmtpClient("smtp.1and1.com", 587);
mailClient.Credentials = new NetworkCredential("[email protected]", "password");
But it always gives me a security exemption error...
I tried it using my local host and it works fine.. I tried using gmail's smtp and it worked fine as well.. It says that I need to authenticate in order to use the smtp server, I did that by looking at the code above... Here's the exact error:
Security Exception
Description: The application attempted
to perform an operation not allowed by
the security policy. To grant this
application the required permission
please contact your system
administrator or change the
application's trust level in the
configuration file.Exception Details:
System.Security.SecurityException:
Request for the permission of type
'System.Net.Mail.SmtpPermission,
System, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089'
failed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要进行身份验证才能发送 SMTP 邮件(常见问题解答中的第 2a 点)
You need to authenticate to send SMTP mail (Point 2a from their FAQ)
我的客户有一个来自 1and1.com 的新主机,对我有用的就是删除端口号,然后它就可以工作了。 1and1为我提供了一个参考链接http://help.1and1.com/hosting-c37630/scripts-and-programming-languages-c85099/aspnet-c39624/send-an-e-mail-using- aspnet-a604246.html
我的代码:
My client has a new hosting from 1and1.com, and the thing that worked for me was to remove the port number and it working. 1and1 provided me a reference link http://help.1and1.com/hosting-c37630/scripts-and-programming-languages-c85099/aspnet-c39624/send-an-e-mail-using-aspnet-a604246.html
My code:
还要确保您的反向 (PTR) 映射回您...否则很多 SMTP 服务器将拒绝您。
also just ensure that your reverse (PTR) maps back to you... otherwise alot of SMTP servers will reject you.