Link to home
Start Free TrialLog in
Avatar of greggoodwin2
greggoodwin2

asked on

Issues Sending Mail Google Apps ASP.Net

Currently I am attempting to send an email using my google apps account which is registered properly for my domain. Upon running the code below I receive the error.

The remote certificate is invalid according to the validation procedure.
MailMessage message = new MailMessage();
            message.To.Add(to);
            message.From = new MailAddress("me@mydomain.com", "myname", System.Text.Encoding.UTF8);
            message.Subject = subject;
            message.SubjectEncoding = System.Text.Encoding.UTF8;
            message.Body = message2;
            message.BodyEncoding = System.Text.Encoding.UTF8;
            message.IsBodyHtml = false;
            message.Priority = MailPriority.Normal;
            SmtpClient emailClient = new SmtpClient();
            emailClient.Credentials = new NetworkCredential("me@mydomain.com", "secret");
            emailClient.Port = 587;
            emailClient.Host = "smtp.gmail.com.";
            emailClient.EnableSsl = true;
            emailClient.Send(message);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of KPMT-Technician
KPMT-Technician
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of greggoodwin2
greggoodwin2

ASKER

Thanks I opened the ports on the web server and removed the (.) now it all runs well!