I can’t configure my mail server to be able to send emails via API

Hi,

I can’t configure my mail server to be able to send emails via API on both IOS and Android from my ShareMyNeeds app. Attached evidence of the configuration attempt and the error obtained:

Configuration:

SMTP Server: smtp.gmail.com

Port: 587

From: ShareMyNeeds

From Email: appsharingneeds@gmail.com

User ID: joamarmir@gmail.com

Password: ········

Error obtained:

Username and Password are not accepted. Message from smtp server: 534-5.7.14
534-5.7.14 if5cU3bzZrV21eteBXQDj6gLvJYN2F4sdVtplCiBisrMO18PpkQ4VkIK1YiRqjEINhmxB
534-5.7.14 OCsXkToaQz9G0bdxbcEoHdHRBhxgBW87NH_em8EkN25oErRk3jLuqCZdCkqVN9uI>
534-5.7.14 Please log in via your web browser and then try again.
534-5.7.14 Learn more at
534 5.7.14 y84sm389349oie.16 - gsmtp

Regards,

Hi @joan-martinez !

It seems that it can be due to disabled “Less secure apps” option on the Google side. Google detects suspicious authorization attempt and block the call. Try to enable this option in your Google account and try again to set up SMTP configuration.
More information about this Google fetature you can find by this link Less secure apps & your Google Account - Google Account Help

Please, write me back about result of your attempt.

Also I have made this topic public since private topics are only for PRO customers.

Regards, Andriy

Hi Andriy,

Now I have in the account “appsharingneeds@gmail.com” activated the access of less secure applications. When performing the server configuration again with:

SMTP Server: smtp.gmail.com

Port: 465

From: SharingNeeds

From Email: appsharingneeds@gmail.com

User ID: appsharingneeds@gmail.com

Password: ········

The error I am getting now is:

 "Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1"

And if I disable it I get the same error.

And if I try with 587 port, the error is the error is activating or not activating the indicator of less secure applications:

"Username and Password are not accepted. Message from smtp server: 535-5.7.8 Username and Password not accepted. "

I don’t know what to try anymore …

Heeeeeeeelp !!!

There is one more detail which can cause problems.
For port 587 “TLS” security should be selected.
For port 465 “SSL” security should be selected.
Have you specified correctly security when configured SMTP?

Also check once more “Less secure apps” option. Google can turn it off without warning you.

Regards, Andriy

I have tested again with the security conditions that you indicate and making sure that the indicator that allows access to less secure applications is activated. The result is the same:

“Username and Password are not accepted. Message from smtp server: 534-5.7.14”

:sweat:

Here is google’s page with instructions for configuring SMTP email relay:
https://support.google.com/a/answer/176600?hl=en

Regards,
Mark

Hi @joan-martinez !

If you still not able to configure SMTP for your app you can also try to follow pieces of advice given in this answer to the question email - how to fix "send-mail: Authorization failed 534 5.7.14 " - Server Fault

Regards, Andriy

Hi Andriy,

I have achieved it using the SMTP server:

       "aspmx.l.google.com"

from port 25.

At the moment the shipments are made for all the email accounts that I have used as recipients. The only problem is that in some of them the received mail appears as spam and I am investigating how to avoid it.

Regards, Joan

1 Like

Great to hear that you are managed to configure SMTP.

If to talk about spam problem - one of the reasons why emails can be marked as spam is the different emails in “From Email” and “User ID” fields. I am pointing it out because in one of your examples you used different emails for this fields.

Regards, Andriy