Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Issues Sending Mail Google Apps ASP.Net

Posted on 2009-04-01
2
Medium Priority
?
519 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
KPMT-Technician earned 2000 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

Vim Reference Guide

Vim is a powerful text editor favored by many sysadmins and developers - here are some commands that you'll want to keep in your back pocket!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

721 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