问题描述
有没有人尝试过使用1& 1 smtp主机发送电子邮件?我尝试了以下吗?
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...
我使用本地主机尝试了它,并且运行正常..我尝试使用gmail的smtp,它也运行正常..它说我需要进行身份验证才能使用smtp服务器,我通过查看上面的代码...这是确切的错误:
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:
说明:应用程序尝试执行不允许的操作安全政策.授予这个应用所需的权限请与您的系统联系管理员或更改应用程序中的信任级别配置文件.
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.
异常详细信息:System.Security.SecurityException:请求类型的许可'System.Net.Mail.SmtpPermission,系统,版本= 2.0.0.0,文化=中立,PublicKeyToken = b77a5c561934e089'失败.
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.
推荐答案
您需要进行身份验证以发送SMTP邮件(来自其常见问题解答)
You need to authenticate to send SMTP mail (Point 2a from their FAQ)
这篇关于1& 1虚拟主机和smtp配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!