How can I send email from my local host using yahoo mail account?

主宰稳场 提交于 2020-01-17 04:21:11

问题


I am developing an ASP.NET website using Visual studio 2010 ultimate. I want to send mail for confirmation to the clients using my yahoo mail account. How can I do so ? what settings should I change or add ?


回答1:


Here is the Yahoo mail settings

  • Yahoo! Mail SMTP server address: smtp.mail.yahoo.com
  • Yahoo! Mail SMTP user name: Your full Yahoo! Mail email address (including "@yahoo.com")
  • Yahoo! Mail SMTP password: Your Yahoo! Mail password
  • Yahoo! Mail SMTP port: 465
  • Yahoo! Mail SMTP TLS/SSL required: yes

Here is a sample code to send email using yahoo mail settings

SmtpClient emailClient = new SmtpClient("smtp.mail.yahoo.com");
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("xyz@yahoo.com","*******"); 
emailClient.EnableSsl = true;
emailClient.Credentials = SMTPUserInfo;
emailClient.Port = 465;

MailMessage message = new System.Net.Mail.MailMessage("xyz@gmail.com", "someone@something.something", "fire!!", "Call up 911 and inform my house is on fire and my phone too");
emailClient.Send(message);



回答2:


You need to have smtp/pop access to yahoo mail in order to send the mail using yahoo account. The free account offered by yahoo does not have that access. You might have to opt for yahoo mail pro.

For sending a mail using SMTP, all you need is username and password of an smtp account. You will use the pass this credentials and send the mail with classes system.net.mail namespace.




回答3:


You can check this project:

http://www.codeproject.com/Articles/1684/Sending-Mail-Using-C-via-SMTP

There you will see how to setup configuration to send a mail using any (in your case yahoo) smtp server to send an email.



来源:https://stackoverflow.com/questions/12769270/how-can-i-send-email-from-my-local-host-using-yahoo-mail-account

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