Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Adding instructions for using gmail for smtp #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kevindaum
Copy link

I learned how to get this app to work with gmail as an SMTP server after
seeing this pop up in the heroku logs:

SMTPAuthenticationError: (534, '5.7.14
\<https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt9\n5.7.14
5fyrM2inKhVY4XqMikj2eHHiokAMs8QCUHHspLnw7XBxotrfoevoluVAPoF\_Rqm-fQiec4\n5.7.14
G7lsexXkc5\_v6GsEMZH6A9\_Y-xyVIn0K9\_X-SEiFdnb8fn4-5BQgpBtWrLdwEDdHmWzEfx\n5.7.14
vk0rxT8bOFWuq-fUfA-yyOLK\_Ue8fNc2XU2jZTlRSm1QOa3VO08nRc99aV0Hjb6wzcsWYv\n5.7.14
YR\_P0CMzz\_dOxb7n7odEjtaSROTJs\> Please log in via your web browser
and\n5.7.14 then try again.\n5.7.14  Learn more at\n5.7.14
https://support.google.com/mail/answer/78754 107sm5305143qge.16 -
gsmtp')

After turning on "Access for less secure apps" in my "from" google app
email account, suddenly the emails started sending using either SSL or
TLS.

Note: I considered changing the environment variables so that the user
would pick SSL, TLS or no encryption and the app would automatically
pick 465, 587 or 25 for the port. However, since SSL is insecure and
you're asking the user to store their password as an environment
variable, I think it makes sense to force TLS. This means that you could
not even ask for the port and just set it to 587. However, this may make
the app unusable for folks who use an SMTP server that uses non-standard
ports.

I learned how to get this app to work with gmail as an SMTP server after
seeing this pop up in the heroku logs:

```
SMTPAuthenticationError: (534, '5.7.14
\<https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt9\n5.7.14
5fyrM2inKhVY4XqMikj2eHHiokAMs8QCUHHspLnw7XBxotrfoevoluVAPoF\_Rqm-fQiec4\n5.7.14
G7lsexXkc5\_v6GsEMZH6A9\_Y-xyVIn0K9\_X-SEiFdnb8fn4-5BQgpBtWrLdwEDdHmWzEfx\n5.7.14
vk0rxT8bOFWuq-fUfA-yyOLK\_Ue8fNc2XU2jZTlRSm1QOa3VO08nRc99aV0Hjb6wzcsWYv\n5.7.14
YR\_P0CMzz\_dOxb7n7odEjtaSROTJs\> Please log in via your web browser
and\n5.7.14 then try again.\n5.7.14  Learn more at\n5.7.14
https://support.google.com/mail/answer/78754 107sm5305143qge.16 -
gsmtp')
```

After turning on "Access for less secure apps" in my "from" google app
email account, suddenly the emails started sending using either SSL or
TLS.

Note: I considered changing the environment variables so that the user
would pick SSL, TLS or no encryption and the app would automatically
pick 465, 587 or 25 for the port. However, since SSL is insecure and
you're asking the user to store their password as an environment
variable, I think it makes sense to force TLS. This means that you could
not even ask for the port and just set it to 587. However, this may make
the app unusable for folks who use an SMTP server that uses non-standard
ports.
In case the user doesn't notice, there are tests for sending emails.

Note: WattTime#1 must be
merged before these instructions will work.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants