2

I'm trying to send out an email from my Gmail account using Postal:

dynamic email = new Email("Appointment");
email.To = "sergiotapia@outlook.com";
email.Send();

And I get this error:

System.Net.Mail.SmtpException: {"The SMTP server requires a secure connection or the client was not authenticated.The server response was: 5.7.0 Must issue a STARTTLS command first.

Any ideas what I need to do to send this email out?

Here's my web.config setting:

<system.net>
    <mailSettings>
        <smtp deliveryMethod="Network" from="asdf@adsf.ly.com">
        <network host="smtp.gmail.com" port="587" defaultCredentials="false" userName="asdf@adsf.ly" password="asdf" />
        </smtp>
    </mailSettings>
</system.net>
Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
sergserg
  • 21,716
  • 41
  • 129
  • 182

3 Answers3

10

As the error clearly states, Gmail only accepts SSL connections.

Add enableSsl="true" to your config.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
1

You should use secure connection when you try to sending an mail. Try this in your config;

enableSsl="true"

Problems sending mail

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
0

I got the same problem. but now fixed by using this config

<system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="dotnet1235@gmail.com">
        <network host="smtp.gmail.com" port="587"
                 defaultCredentials="false"
                 userName="dotnet1235@gmail.com"
                 password="bla_bla"
                 enableSsl="true"/>
      </smtp>
    </mailSettings>
  </system.net>

I follow the step on this blog http://fat-night.blogspot.com/2014/09/c-postal-mvc-5-menggunakan-gmail-mail.html

Fathur
  • 11
  • 4