问题描述
有没有人尝试过使用 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("admin@permias-tucson.com", "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 邮件(Point 2a from their 常见问题)
You need to authenticate to send SMTP mail (Point 2a from their FAQ)
这篇关于1&1 网络托管和 smtp 配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!