Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

ASP.NET - Error in sending Email from Google Apps

  Asked By: Suzan    Date: May 20    Category: Asp.net    Views: 1416

I want to send EMail from my Website hosted at http://hostforlife.eu, and we are using Google Apps for Emails.

Here is my code in ASP.Net/ C#
MailMessage mMailMessage = new MailMessage();
mMailMessage.From = new MailAddress("utility@mydomain.com", "GotFeedback", System.Text.Encoding.UTF8);
mMailMessage.To.Add(new MailAddress("feedback@mydomain.com"));
mMailMessage.Subject = "subject";
mMailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
mMailMessage.Body = body;
mMailMessage.BodyEncoding = System.Text.Encoding.UTF8;
mMailMessage.IsBodyHtml = true;
mMailMessage.Priority = MailPriority.Normal;

SmtpClient mSmtpClient = new SmtpClient();
mSmtpClient.UseDefaultCredentials = false;
mSmtpClient.Credentials = new System.Net.NetworkCredential("utility@mydomain.com", "mypassword");
mSmtpClient.Host = "SMTP.GOOGLE.COM";
mSmtpClient.Port = 587;
mSmtpClient.EnableSsl = true;
catch(Exception e)
string edsf = e.ToString();

But I am getting Exception that it is unable to connect to remote server :( Please help. Thanks!



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on ASP.NET - Error in sending Email from Google Apps Or get search suggestion and latest updates.