Yandex smtp settings with ssl

匿名 (未验证) 提交于 2019-12-03 09:06:55

问题:

I can send emails via enableSsl="false" and 25 port. But it is not enought in case with own domain.

What is wrong or missing in this settings?

<system.net>     <mailSettings>       <smtp  deliveryMethod="Network" from="Name">         <network  host="smtp.yandex.ru" port= "465 " enableSsl="true" userName="noreply@domain.com" password="***" />       </smtp>     </mailSettings>   </system.net> 

回答1:

using (MailMessage mm = new MailMessage("Name <from@yandex.ru>", "to@site.com")){     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("from@yandex.ru", "YandexPassword");         sc.Send(mm);     } } 


回答2:

It seems that port 25 not work already. You can use port 587 with SmtpClient and yandex mail.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!