如何从VB.NET或C#.NET代码中的yahoo邮件ID发送邮件

时间:2009-03-26 03:49:44

标签: c# vb.net

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

Sivakumar.P

2 个答案:

答案 0 :(得分:2)

以下是执行基本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("you@yahoo.com", "Your Name")
    m.To.Add(New MailAddress("Recipient@somedomain.com", "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("you@yahoo.com", "Your Name");
    m.To.Add(new MailAddress("Recipient@somedomain.com", "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);

答案 1 :(得分:0)

可以找到一般的想法here

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