2015-10-26 108 views
0

我收到以下錯誤發送電子郵件:無法通過本地主機

Failure sending mail 

和內部異常是

Unable to connect to the remote server 
在C#

MailMessage mail = new MailMessage("[email protected]", "[email protected]","Newsletter", "This is a test mail"); 
SmtpClient client = new SmtpClient("localhost"); 
client.Send(mail); 

這是我的本地SMTP電子郵件設置在IIS 7中。

enter image description here

還安裝了SMTP服務器工具

enter image description here

+0

是實際運行的smtp服務嗎? –

+0

我沒有看到任何服務。我在哪裏開始smtp服務? –

+0

可能在某處iis管理器中。 –

回答

0

嘗試在IIS SMTP設置中的「電子郵件地址」字段設置爲發件人地址所使用。

SOURCE