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

12,185

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

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);
Share:
12,185
sivakumar
Author by

sivakumar

Updated on June 04, 2022

Comments

  • sivakumar
    sivakumar almost 2 years

    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.

    Sivakumar.P