Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
unable to send Email using gmail on godaddy but it works o localhost :(
Posted
Comments
vivektiwari97701 16-Oct-12 1:45am    
update ur qst. with code

Hi,

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.

thanks.
 
Share this answer
 
Comments
Surendra0x2 16-Oct-12 1:47am    
Sir i know how to send email using gmail in asp.net 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 = "surendra.verma1989@gmail.com";
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 = "smtp.gmail.com";
client.Port = 465;

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

MailMessage msg = new MailMessage();
msg.From = new MailAddress("musicmaniauser@gmail.com");
msg.To.Add(new MailAddress("surendra.verma1989@gmail.com"));

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

try
{
client.Send(msg);
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 ?
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

http://vandelayweb.com/sending-asp-net-emails-godaddy-gmail-godaddy-hosted/

C#
//Create the msg object to be sent

MailMessage msg = new MailMessage();
//Add your email address to the recipients
msg.To.Add("mr@soundout.net");
//Configure the address we are sending the mail from
MailAddress address = new MailAddress("mr@soundout.net");
msg.From = address;
msg.Subject = txtSubject.Text;
msg.Body = txtName.Text + "n" + txtEmail.Text + "n" + txtMessage.Text;

SmtpClient client = new SmtpClient();
client.Host = "relay-hosting.secureserver.net";
client.Port = 25;

//Send the msg
client.Send(msg);
 
Share this answer
 
SmtpClient ss = new SmtpClient();
               ss.Host = "relay-hosting.secureserver.net";
                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", "demo@gmail.com", "subject here", "my body");
                mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
                ss.Send(mailMsg);
 
                Response.Write("Mail Sent");
 
Share this answer
 
Comments
Pravinkumar Putta 16-Jun-17 4:18am    
Thanks....

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