可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.