0

I had my web.config mail section like that:

<smtp from="mail@gmail.com">
    <network enableSsl="true" host="smtp.gmail.com" port="587" userName="mail@gmail.com" password="pwd" />
</smtp>

Tested locally, but I got an error on production(i am using shared hosting environment):

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

I googled I find out possible solution, so I changed my configuration as:

<smtp from="mail@gmail.com">
        <network enableSsl="true" host="smtp.gmail.com" port="587" userName="mail@gmail.com" password="pwd" defaultCredentials="true"/>
</smtp>

And now I got this error:

he 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. ko10sm114859924pbd.38 - gsmtp

How can I fix that?

I also tied to add delivery method:

<smtp from="mail@gmail.com" deliveryMethod="Network">
            <network enableSsl="true" host="smtp.gmail.com" port="587" userName="mail@gmail.com" password="pwd" defaultCredentials="true"/>
    </smtp>

But ho way.

UPDATE

I just checked my gmail and find out email from google

Someone recently used your password to try to sign in to your Google Account xxxxxxx@gmail.com. This person was using an application such as an email client or mobile device.

We prevented the sign-in attempt in case this was a hijacker trying to access your account. Please review the details of the sign-in attempt:

Monday, January xxx.xxx UTC IP Address: xxx.xxx.xxx.xxx Location: Unknown

So may be it is the reason why email send not working on production. Because it is a new location and when you sign in from a new location on gmail you should answer security questions. So it make scene then why email is not working. So i am looking now how to unblock that locaton/ip address on gmail if it is possible.

Sergino
  • 10,128
  • 30
  • 98
  • 159
  • Have you tried sending a manual email (using the `SmtpClient` class directly) with the same settings? That would at least eliminate one possibility. – Tieson T. Jan 06 '14 at 09:15
  • If it helps, here's a Gist of some code I used to use: https://gist.github.com/tiesont/8280201 – Tieson T. Jan 06 '14 at 09:25

1 Answers1

0

Change this:

<smtp from="mail@gmail.com">

to this:

<smtp from="mail@gmail.com" deliveryMethod="Network">

Edit: I also found this question, hope it helps.


Edit 2: Other solutions:

Community
  • 1
  • 1
Marthijn
  • 3,292
  • 2
  • 31
  • 48