hii...
can any body help me by solving this ???
i made a simple email sending page...
i m getting this error...
Quote:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at
Source Error:
Line 49: smtp.Credentials = new System.Net.NetworkCredential("kingofisrani@gmail.com", "bhuligayo2211");
Line 50: smtp.EnableSsl = true;
Line 51: smtp.Send(obj);
Line 52: Response.Write("msg sent successfully");
Line 53: }
my page is with 4 textbox and two button...
in my a
spx.cs file.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Net.Mail;
using System.Net;
using System.IO;
public partial class WebSite1_email : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn_cancle_Click(object sender, EventArgs e)
{
Response.Redirect("home.aspx");
}
protected void btn_send_Click(object sender, EventArgs e)
{
MailMessage obj = new MailMessage(txt_from.Text,txt_to.Text,txt_title.Text,txt_subject.Text);
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.Credentials = new System.Net.NetworkCredential("kingofisrani@gmail.com", "password");
smtp.EnableSsl = true;
smtp.Send(obj);
Response.Write("msg sent successfully");
}
}
and my
.config file is like below.
="1.0"
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
</system.web>
<connectionStrings>
<add name="webconn" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Administrator\Desktop\vikas\App_Data\Database.mdf;Integrated Security=True;User Instance=True"/>
</connectionStrings>
<system.net>
<mailSettings>
<smtp from="kingofisrani@gmail.com" deliveryMethod="Network">
<network host="smtp.gmail.com" userName="username" password="passoword" port="587" enableSsl="true" defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net>
</configuration>
plzzz give me solution of this... i will be thankful to you...