Hi,
Is there any error message that you see? Please make sure you contact your hosting provider and ask them about correct settings that you need to use.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am encountering an issue while trying to send emails through an ASP.NET Web Forms application hosted on GoDaddy's server. The goal is to send emails from a Gmail address using C# and the SmtpClient.
using (MailMessage mm = new MailMessage("******@gmail.com", "******@gmail.com"))
{
mm.Subject = "test";
mm.Body = "test";
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "relay-hosting.secureserver.net";
smtp.EnableSsl = true;
smtp.Port = 25;
NetworkCredential NetworkCred = new NetworkCredential("******@gmail.com", "XXXXXX");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Send(mm);
}
Hi,
Is there any error message that you see? Please make sure you contact your hosting provider and ask them about correct settings that you need to use.
Hi @81898447
Google Mail's host should be "smtp.gmail.com" and the port is 587.
Change code:
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
Best regards,
Qi You
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.