2012-06-18 83 views
1

我可以通過enableSsl =「false」和25端口發送電子郵件。但是對於自己的域名來說,這還不夠。Yandex的smtp設置與ssl

這種設置有什麼問題或缺失?

<system.net> 
    <mailSettings> 
     <smtp deliveryMethod="Network" from="Name"> 
     <network host="smtp.yandex.ru" port= "465 " enableSsl="true" userName="[email protected]" password="***" /> 
     </smtp> 
    </mailSettings> 
    </system.net> 

回答

2
using (MailMessage mm = new MailMessage("Name <[email protected]>", "[email protected]")){ 
    mm.Subject = "Mail Subject"; 
    mm.Body = "Mail Body"; 
    mm.IsBodyHtml = false; 
    using (SmtpClient sc = new SmtpClient("smtp.yandex.ru", 25)){ 
     sc.EnableSsl = true; 
     sc.DeliveryMethod = SmtpDeliveryMethod.Network; 
     sc.UseDefaultCredentials = false; 
     sc.Credentials = new NetworkCredential("[email protected]", "YandexPassword"); 
     sc.Send(mm); 
    } 
} 
2

看來,25端口尚未工作。您可以使用帶有SmtpClient和yandex郵件的端口587。