2010-04-12 122 views
0

有没有人曾经尝试发送电子邮件使用1 & 1 smtp主机?我尝试了以下?1&1网络托管和smtp配置

SmtpClient mailClient = new SmtpClient("smtp.1and1.com", 587); 
mailClient.Credentials = new NetworkCredential("[email protected]", "password"); 

但它总是给我一个安全免除错误...

我尝试了用我的本地主机上工作得很好。我尝试使用Gmail的SMTP,它工作得很好,以及它..说我需要为了使用SMTP服务器进行身份验证,我也通过看上面的代码......这里是确切的错误:

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.

+1

也许你应该联系1&1,以确保一切设置正确? – 2010-04-12 16:22:32

+0

在英国,您需要使用auth.smtp.1and1.co.uk并提供您的帐户凭据以发送电子邮件。 – 2010-04-12 16:22:59

+0

我确实在我使用的代码下面提供了我的凭据... – aherlambang 2010-04-12 16:28:07

回答

1

您需要进行身份验证(从他们FAQ地点2A)

+0

问题是我如何验证? – aherlambang 2010-04-12 16:29:41

+0

我明白的身份验证只是意味着提供用户名和密码在smtp和我从上面的代码 – aherlambang 2010-04-12 16:42:59

+0

谷歌搜索'1and1 system.net.mail'引发了很多人有同样的问题,这个SO帖子从一些几个月前http://stackoverflow.com/questions/1915032/1and1-windows-hosting-with-asp-net“1and1不允许访问system.net.mail” – 2010-04-12 18:01:27

0

也只是确保你的反向(PTR)映射回你......否则很多SMTP服务器都会拒绝你。

0

我的客户发送SMTP邮件已经从1and1.com一个新的托管,并为我工作的事情被删除的端口号和它的工作。的1and1为我提供一个参考链接http://help.1and1.com/hosting-c37630/scripts-and-programming-languages-c85099/aspnet-c39624/send-an-e-mail-using-aspnet-a604246.html

我的代码:

SmtpClient objSmtp = new SmtpClient("smtp.1and1.com"); 
objSmtp.EnableSsl = true; 
objSmtp.Credentials = new 
System.Net.NetworkCredential("[email protected]", "PWD");