Solved

Issues Sending Mail Google Apps ASP.Net

Posted on 2009-04-01
2
503 Views
Last Modified: 2013-12-17
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

0
Comment
Question by:greggoodwin2
2 Comments
 
LVL 5

Accepted Solution

by:
KPMT-Technician earned 500 total points
ID: 24042415
I have a few questions:
  Is the machine that is running this web appication have the ablitity to communication with google via port 587?
  Is the machine that is running this web application behind a firewall?
  Line 11 on the above sample code - Are the Network Credential a valid Google email address?

Comment:
  Line 13 on the above sample code - "smtp.gmail.com." remove the last (.) - type-o only, dns will resovle the correct IP Address with or without it.
0
 

Author Closing Comment

by:greggoodwin2
ID: 31565416
Thanks I opened the ports on the web server and removed the (.) now it all runs well!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now