Yandex smtp settings with ssl

2019-06-01 07:53发布

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>

2条回答
走好不送
2楼-- · 2019-06-01 08:23

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

查看更多
可以哭但决不认输i
3楼-- · 2019-06-01 08:41
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);
    }
}
查看更多
登录 后发表回答