2010-04-12 72 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");