Click here to Skip to main content
15,896,306 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i use the simple mail sending application but the following error occure during sending the mail

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
i use windoes7 and asp.net(c#).

plz help me.
Posted
Comments
Richard MacCutchan 24-Aug-12 5:40am    
That message seems quite clear; the email server does not allow you to send email unless you provide authentication via a userid and password. Edit your question and add the code you are using and someone will probably show you how to fix it.
RAKESH CHAUBEY 24-Aug-12 5:43am    
Check Network.Cridential ("Have Correct Email And Password") And Try Debug at what Level You Get this issue . And Paste That Area if yiu cannot paste the Whole Code .

C#
SmtpClient client = new SmtpClient();
        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        client.EnableSsl = false;
        client.Host = "smtp.gmail.com";
        client.Port = 587;                 // setup Smtp authentication    
        System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("****@gmail.com", "******");
        client.UseDefaultCredentials = false;
        client.Credentials = credentials;
        MailMessage msg = new MailMessage();
        msg.From = new MailAddress("rma.maksat@gmail.com");
     
        msg.To.Add(new MailAddress("prateekfgiet@gmail.com"));
      
        msg.Subject = "New RMA No:'" + DropDownList1.SelectedValue.ToString() + "'";
        msg.IsBodyHtml = true;
        msg.Body = "Status is : '" + DropDownList3.SelectedValue.ToString() + "',      for the Request of RMA No:'" + DropDownList1.SelectedValue.ToString() + "'";
        client.Send(msg);
 
Share this answer
 
v2
Comments
Anuja Pawar Indore 24-Aug-12 9:44am    
Added code block
C#
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using System.Net.Mail;

protected void Page_Load(object sender, EventArgs e)
   {

       String mailMsg = "Hello, "      
       objEmail.To.Add("email@yourdomain.com");
       objEmail.CC.Add("email@yourdomain.com");
       objEmail.From = new MailAddress("email@yourdomain.com", "Company Name");
       objEmail.Subject = "Text mail";
       objEmail.Body = mailMsg;
       objEmail.IsBodyHtml = true;
       objEmail.Priority = MailPriority.High;
       SmtpClient smtp1 = new SmtpClient();
       smtp1.Host = "relay-hosting.secureserver.net";
       smtp1.UseDefaultCredentials = false;
       smtp1.EnableSsl = false;
       try
       {
           smtp1.Send(objEmail);
           objEmail.Dispose();
           objEmail = null;

       }
       catch (Exception exc)
       {
           
           string msg = exc.Message;
           
       }
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900