c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
c# .net

How to send yahoo email in asp.net c# uses smtp server yahoo?

| | ASP-NET , CSharp

In this article I will show you how to send email using asp.net c#. You need to configure the yahoo mail smtp server in SmtpClient class from the namespace System.Net.Mail.

HTML Markup:

<form id="form1" runat="server">
        <div>
            <table>
                <tr>
                    <th colspan="2">Sending Mails using Yahoo...!!!
                    </th>
                </tr>
                <tr>
                    <td style="width: 40px;">To : </td>
                    <td>
                        <asp:TextBox ID="txtEmailId" 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="sentmail" runat="server"
                            Text="Sending Mail using Yahoo" OnClick=" btnSentMail" /></td>
                </tr>
            </table>
        </div>
    </form>

C# coding:

protected void btnSentMail(object sender, EventArgs e)
    {
        MailMessage ms = new MailMessage("your yahoomail id", txtEmailId.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 yahoomail id ", "your password");
        smtp.EnableSsl = true;
        smtp.Send(ms);
    }                        

 

 

If you’re getting error “smtp server requires a secure connection 5.5.1”. It will be resolved by the following way click SMTP server requires a secure connection or the client was not authenticated