Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
unable to send Email using gmail on godaddy but it works o localhost :(
Posted 15-Oct-12 20:12pm
Comments
vivektiwari97701 at 16-Oct-12 1:45am
   
update ur qst. with code
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
Surendra0x2 at 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 at 16-Oct-12 1:50am
   
The server response was: 5.5.1 Authentication Required. " getting this error on godaddy hosting
@AmitGajjar at 16-Oct-12 1:50am
   
Can you post your code,
Surendra0x2 at 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 at 16-Oct-12 2:50am
   
are you passing from email address ?
@AmitGajjar at 16-Oct-12 2:53am
   
also check your network credentials are correct.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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");
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2014
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