如何在VB.NET或C#.NET代码中从雅虎邮件ID发送邮件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/684454/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 13:21:23  来源:igfitidea点击:

How to send mail from yahoo mail Id in VB.NET or C#.NET code

c#vb.net

提问by sivakumar

I want to send mail from my yahoomail Id.How to send mail from yahoo mail Id in VB.NET or C#.NET code. Kind help needed.. Advance Thanks.

我想从我的 yahoomail Id 发送邮件。如何在 VB.NET 或 C#.NET 代码中从 yahoo mail Id 发送邮件。需要帮助.. 提前谢谢。

Sivakumar.P

西瓦库玛

采纳答案by Tom Alderman

Here are some examples of doing a basic html email messages.

下面是一些制作基本 html 电子邮件的示例。

http://help.yahoo.com/l/us/yahoo/mail/original/mailplus/pop/pop-14.html

http://help.yahoo.com/l/us/yahoo/mail/original/mailplus/pop/pop-14.html

  ' VB

    Dim m As MailMessage = New MailMessage
    m.From = New MailAddress("[email protected]", "Your Name")
    m.To.Add(New MailAddress("[email protected]", "Recipient Name"))
    m.Subject = "Hello"
    ' Specify an HTML message body
    m.Body = "<html><body><h1>My Message</h1><br>Put the body here.</body></html>"
    m.IsBodyHtml = True
    ' Send the message
    Dim client As SmtpClient = New SmtpClient("smtp.mail.yahoo.com")
    client.Send(m)






  // C#

    MailMessage m = new MailMessage();
    m.From = new MailAddress("[email protected]", "Your Name");
    m.To.Add(new MailAddress("[email protected]", "Recipient Name"));
    m.Subject = "Hello";
    // Specify an HTML message body
    m.Body = "<html><body><h1>My Message</h1><br>Put the body here.</body></html>";
    m.IsBodyHtml = true;
    // Send the message
    SmtpClient client = new SmtpClient("smtp.mail.yahoo.com");
    client.Send(m);

回答by JeffH

The general idea can be found here

一般的想法可以在这里找到

For specifics of Yahoo SMTP, log in to your Yahoo account and click on "Account Info", then "POP, SMTP and NNTP server settings"

有关 Yahoo SMTP 的详细信息,请登录您的 Yahoo 帐户并单击“帐户信息”,然后单击“POP、SMTP 和 NNTP 服务器设置”