P2Pprogrammer 2 programmer

Home > Programmer2Programmer.NET Forum> ASP.NET and Web Development >> Sending Message Through the Asp.net...

Welcome Guest My Thread | Search | Active Topics | Members | Log In | Register

NOTE : Log In required to post Replies for this discussion.
Sending Message Through the Asp.net
Jitender Badoni Posted: Saturday 04, June 2011 11:26:33 AM     
First i want to show the error:

The SMTP server requires a secure connection or the client was 
not authenticated

the code is:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public partial class _Default : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e)

    protected void Button1_Click(object sender, EventArgs e)
            MailMessage msg = new MailMessage(txtFrom.Text, txt
To.Text, txtSub.Text, txtBody.Text);
            SmtpClient emailClient = new SmtpClient("smtp.gmail
            System.Net.NetworkCredential SmtpusrInfo = new Syst
em.Net.NetworkCredential(txtUserName.Text, txtPassword.Text,"sm
            emailClient.UseDefaultCredentials = false;
            emailClient.Credentials = SmtpusrInfo;
        catch (Exception ex)

Back to Top ^  

Home > Programmer2Programmer.NET Forum >ASP.NET and Web Development >> Sending Message Through the Asp.net...