Gmail SMTP settings

Farah El Agha asked on January 11, 2018 11:06

hello guys, I am trying to configure SMTP for newsletter emails. I set SMTP server to smtp.gmail.com and the username and pass for SMTP are the credentials for my email. I am facing two errors: when setting the server to smtp.gmail.com:465 I am getting this "Failure sending mail.

Message: Failure sending mail.

Exception type: System.Net.Mail.SmtpException Stack trace: at System.Net.Mail.SmtpClient.Send(MailMessage message) at CMS.EmailEngine.EmailProvider.SendEmailInternal(String siteName, MailMessage message, SMTPServerInfo smtpServer) at CMS.EmailEngine.EmailSender.SendTestEmail(String siteName, EmailMessage message, SMTPServerInfo smtpServer) at CMSModules_System_System_Email.SendEmail() in C:\inetpub\wwwroot\Lebanon\Lade\lade-portal\CMS\CMSModules\System\System_Email.aspx.cs:line 122 at CMSModules_System_System_Email.btnSend_Click(Object sender, EventArgs e) in C:\inetpub\wwwroot\Lebanon\Lade\lade-portal\CMS\CMSModules\System\System_Email.aspx.cs:line 78

Message: Unable to read data from the transport connection: net_io_connectionclosed."

And when setting the server to smtp.gmail.com:587 or smtp.gmail.com I am getting this: "The remote certificate is invalid according to the validation procedure.

Message: The remote certificate is invalid according to the validation procedure.

Exception type: System.Security.Authentication.AuthenticationException"

how to adjust this?

Correct Answer

Brenden Kehren answered on January 11, 2018 15:42

Not a fan of using Gmail SMTP because not only does it require you to have a valid gmail login but anyone you send an email from has to be a valid email account. So if any of your emails don't have the email address you're authenticating with for the connection, they won't go through. This probably explains the first error.

The second error is because it needs a secure port.

I suggest using SendGrid. It's free for up to 25,000 emails per month and you don't have the hassle as you do with Gmail.

2 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.