Asp.net Sending Emails through YahooMail


sending email using yahoo

In previous article I explained How to Send Multiple Emails by Using Gmail Account. Now i show how to Send Emails through Yahoomail ID in Asp.net by using C# coding and Resolve a SMTP Server Secure Connection and Authentication 5.5.1 Required Error | The SMTP Server Requires a Secure Connection or the Client was not authenticated.

In these Tutorials, we see how to sending email using Yahoo in asp.net, for sending email we use two class's i.e MailMessage Class and SMTPClient Class these two Class are predefined class from this namespaces (System.Net.Mail Namespace).

HTML Markup : Create Email Sending with Yahoo Page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sending-Mail-Yahoo.aspx.cs" Inherits="Mail_Sending_Mail_Yahoo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <table>
       <tr>
        <th colspan="2">
         Sending Mails through Yahoo...!!!
        </th>
       </tr>
       <tr>
        <td style="width:20px;">To : </td>
        <td><asp:TextBox ID="txt_to_emailID" runat="server" Width="310px"></asp:TextBox></td>
       </tr>
       <tr>
        <td colspan="2">
         <asp:TextBox ID="txt_msg" runat="server" TextMode="MultiLine" Height="149px" 
                Width="329px"></asp:TextBox>
        </td>
       </tr>
       <tr>
        <td colspan="2"><asp:Button ID="Btn_sending_Yahoo" runat="server" 
                Text="Sending Mail Through Yahoo" onclick="Btn_sending_Yahoo_Click" /></td>
       </tr>
      </table>
    </div>
    </form>
</body>
</html>

C# Coding

C# Coding : Sending Email with Yahoo Code

protected void Btn_sending_Yahoo_Click(object sender, EventArgs e)
    {
        MailMessage ms = new MailMessage("Your Yahoo ID", txt_to_emailID.Text);
        ms.Subject = "Testing Sending Mail through Yahoo";
        ms.Body = txt_msg.Text;
        ms.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient("smtp.mail.yahoo.com", 587);
        smtp.Credentials = new System.Net.NetworkCredential("Your Yahoo ID", "Your Yahoo Password");
        smtp.EnableSsl = true;
        smtp.Send(ms);
    }

Next Tutorials : How to Resove SMTPException



The SMTP SEVER Requires Secure Connection or the Client was not Authenticated the Server Response was 5.5.1 Authentication Required
0 Komentar untuk "Asp.net Sending Emails through YahooMail"

Back To Top