Sending email through Gmail SMTP server with C#

For some reason neither the accepted answer nor any others work for me for “Sending email in .NET through Gmail”. Why would they not work?

UPDATE: I have tried all the answers (accepted and otherwise) in the other question, but none of them work.

I would just like to know if it works for anyone else, otherwise Google may have changed something (which has happened before).

When I try the piece of code that uses SmtpDeliveryMethod.Network, I quickly receive an SmtpException on Send(message). The message is

The SMTP server requires a secure connection or the client was not authenticated.

The server response was:

5.5.1 Authentication Required. Learn more at” <– seriously, it ends there.

UPDATE:

This is a question that I asked a long time ago, and the accepted answer is code that I’ve used many, many times on different projects.

I’ve taken some of the ideas in this post and other EmailSender projects to create an EmailSender project at Codeplex. It’s designed for testability and supports my favourite SMTP services such as GoDaddy and Gmail.

29 Answers
29

Leave a Comment