Click here to Skip to main content
13,255,974 members (49,801 online)
Rate this:
Please Sign up or sign in to vote.
See more:
unable to send Email using gmail on godaddy but it works o localhost :(
Posted 15-Oct-12 20:12pm
vivektiwari97701 16-Oct-12 1:45am
update ur qst. with code
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


There are so many articles written on this but let me give you one link from where you can see minor changes that you need in your code,

Email sending from gmail account through ASP.NET [^]

Also post your code to identify exact error.

Surendra0x2 16-Oct-12 1:47am
Sir i know how to send email using gmail in its working fine on localhost but its not working on godaddy hosting :(
Surendra0x2 16-Oct-12 1:50am
The server response was: 5.5.1 Authentication Required. " getting this error on godaddy hosting
@AmitGajjar 16-Oct-12 1:50am
Can you post your code,
Surendra0x2 16-Oct-12 2:46am
string name = TextBox2.Text;
string to = "";
string from = TextBox3.Text;
string subject = TextBox4.Text;
string msg1 = TextBox1.Text;
SmtpClient client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Host = "";
client.Port = 465;

// setup Smtp authentication
System.Net.NetworkCredential credentials =
new System.Net.NetworkCredential("", "xyz");
client.UseDefaultCredentials = false;
client.Credentials = credentials;

MailMessage msg = new MailMessage();
msg.From = new MailAddress("");
msg.To.Add(new MailAddress(""));

msg.Subject = TextBox4.Text; ;
msg.IsBodyHtml = true;
msg.Body = string.Format("Name:" + name + "<br>Sender Email:" + from + "<br>Subject:" + subject + "<br>Message:" + msg1 + "");

lbl.ForeColor = Color.Green;
lbl.Text = "Your message has been successfully sent.";
catch (Exception ex)
lbl.ForeColor = Color.Red;
lbl.Text = "Error occured while sending your message." + ex.Message;
@AmitGajjar 16-Oct-12 2:50am
are you passing from email address ?
@AmitGajjar 16-Oct-12 2:53am
also check your network credentials are correct.
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

this Code Works. i have search from many sites but can't find the solution from any site but this code really works got the help from

//Create the msg object to be sent
MailMessage msg = new MailMessage();
//Add your email address to the recipients
//Configure the address we are sending the mail from
MailAddress address = new MailAddress("");
msg.From = address;
msg.Subject = txtSubject.Text;
msg.Body = txtName.Text + "n" + txtEmail.Text + "n" + txtMessage.Text;
SmtpClient client = new SmtpClient();
client.Host = "";
client.Port = 25;
//Send the msg
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

SmtpClient ss = new SmtpClient();
               ss.Host = "";
                ss.Port = 25;
                ss.Timeout = 10000;
                ss.DeliveryMethod = SmtpDeliveryMethod.Network;
                ss.UseDefaultCredentials = false;
                ss.Credentials = new NetworkCredential("your_full_emailAddress", "YourPassword", "your_Domain");
                ss.EnableSsl = false;
                MailMessage mailMsg = new MailMessage("your_full_emailAddress", "", "subject here", "my body");
                mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
                Response.Write("Mail Sent");
Pravinkumar Putta 16-Jun-17 4:18am

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 14 Mar 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100