我如何使用雅虎邮箱从本地主机发送电子邮件?

时间:2022-11-29 23:40:10

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 ?

我正在开发ASP。NET网站使用Visual studio 2010 ultimate。我想用我的雅虎邮箱把邮件发送给客户。我该怎么做呢?我应该更改或添加什么设置?

3 个解决方案

#1


1  

Here is the Yahoo mail settings

这是雅虎邮箱设置。

  • Yahoo! Mail SMTP server address: smtp.mail.yahoo.com
  • 雅虎邮件SMTP服务器地址:SMTP .mail.yahoo.com。
  • Yahoo! Mail SMTP user name: Your full Yahoo! Mail email address (including "@yahoo.com")
  • 雅虎邮件SMTP用户名:您的全部Yahoo!邮件地址(包括“@yahoo.com”)
  • Yahoo! Mail SMTP password: Your Yahoo! Mail password
  • 雅虎邮件SMTP密码:您的雅虎!邮件密码
  • Yahoo! Mail SMTP port: 465
  • 雅虎邮件的SMTP端口:465
  • Yahoo! Mail SMTP TLS/SSL required: yes
  • 雅虎邮件SMTP TLS/SSL需要:是的。

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

下面是使用yahoo mail设置发送电子邮件的示例代码。

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


0  

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.

您需要使用smtp/pop访问yahoo mail,以便使用yahoo帐户发送邮件。雅虎提供的免费帐户没有这个权限。你可能需要选择雅虎邮箱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.

对于使用SMTP发送邮件,您所需要的只是SMTP帐户的用户名和密码。您将使用此凭据并以类system.net.mail名称空间发送邮件。

#3


0  

You can check this project:

您可以查看这个项目:

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

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.

在这里,您将看到如何设置配置来发送邮件(在您的案例中是yahoo) smtp服务器发送电子邮件。

#1


1  

Here is the Yahoo mail settings

这是雅虎邮箱设置。

  • Yahoo! Mail SMTP server address: smtp.mail.yahoo.com
  • 雅虎邮件SMTP服务器地址:SMTP .mail.yahoo.com。
  • Yahoo! Mail SMTP user name: Your full Yahoo! Mail email address (including "@yahoo.com")
  • 雅虎邮件SMTP用户名:您的全部Yahoo!邮件地址(包括“@yahoo.com”)
  • Yahoo! Mail SMTP password: Your Yahoo! Mail password
  • 雅虎邮件SMTP密码:您的雅虎!邮件密码
  • Yahoo! Mail SMTP port: 465
  • 雅虎邮件的SMTP端口:465
  • Yahoo! Mail SMTP TLS/SSL required: yes
  • 雅虎邮件SMTP TLS/SSL需要:是的。

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

下面是使用yahoo mail设置发送电子邮件的示例代码。

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


0  

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.

您需要使用smtp/pop访问yahoo mail,以便使用yahoo帐户发送邮件。雅虎提供的免费帐户没有这个权限。你可能需要选择雅虎邮箱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.

对于使用SMTP发送邮件,您所需要的只是SMTP帐户的用户名和密码。您将使用此凭据并以类system.net.mail名称空间发送邮件。

#3


0  

You can check this project:

您可以查看这个项目:

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

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.

在这里,您将看到如何设置配置来发送邮件(在您的案例中是yahoo) smtp服务器发送电子邮件。