c# .net

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

How to send yahoo email in asp.net c# uses smtp server yahoo?, someone asked me to explain?

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);
    }                        

 

yahoo send email using asp.net

 

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

Post your comments / questions