How do I use gmail to send emails?

app specific google password does not work.

I included it in etc/config.json but it does not work

11 Replies

"does not work" is not useful info. What are you doing, what is the error?

@parlamas,

We're happy to help you look into this. We'll need a bit more information, though, on what's happening when you're trying to use that password. Can you provide us with specific errors that you're receiving?

Even though we're primarily an infrastructure provider without access to your Linode's internal configurations, we're happy to help as much as we can to get you pointed in the right direction. Also, we have a community of users (like the ones above) who might be able to give you some help as well if we can get some additional info from you.

Thanks!

After about 3 minutes I get this:

TimeoutError at /password-reset/
[Errno 110] Connection timed out
Request Method: POST
Request URL: https://www.political-insurance.com/password-reset/
Django Version: 3.0.3
Exception Type: TimeoutError
Exception Value:
[Errno 110] Connection timed out
Exception Location: /usr/lib/python3.7/socket.py in create_connection, line 716
Python Executable: /home/parlamas/polis/venv/bin/python
Python Version: 3.7.5
Python Path:
['/home/parlamas/polis',
'/usr/lib/python37.zip',
'/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload',
'/home/parlamas/polis/venv/lib/python3.7/site-packages']
Server time: Thu, 27 Feb 2020 05:24:25 +0000

@parlamas Based off of the output you've provided, it appears you are trying to send email with Django. To do this, you'll need to define the below settings in the appropriate file. You'll also want to confirm that your login details are correct.

EMAIL_HOST          = 'smtp.gmail.com'
EMAIL_PORT          = 587
EMAIL_HOST_USER     = 'name@gmail.com'
EMAIL_HOST_PASSWORD = 'gmail_password'
EMAIL_USE_TLS       = True
EMAIL_BACKEND       = 'django.core.mail.backends.smtp.EmailBackend'

The Community is happy to help, but we will be limited in how much we can do so without additional information about your setup and what you're trying to do. If the issue does involve using Django, you may find more assistance from on their community forum from people who frequently use this software.

Additional Resources:

All those data have been correct all along.

I've trying to use an app specific google password.

In etc/config.json:

{
"SECRET_KEY": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"EMAIL_USER": "xxxxx@gmail",
"EMAIL_PASS": "xxxxxxxxxxxxxxx"
}

Google generates a 14-letter password for email accounts with 2-step verification.

I suspect I am supposed to do something more with that generated password than just include it in the config.json file.

Any clue?

You can send one-liner emails on Linux using the technique shown here.

I have a similar problem from my hosts.

Python3:
import smtplib, ssl

port = 587 # For starttls
smtp_server = "smtp.gmail.com"
sender_email = "user75@gmail.com"
receiver_email = "duh@not.com"
password = "VALIDPASS"
message = "Subject: Hi there\n\nThis message is sent from Python."

context = ssl.create_default_context()
with smtplib.SMTP(smtp_server, port) as server:
server.ehlo() # Can be omitted
server.starttls(context=context)
server.ehlo() # Can be omitted
server.login(sender_email, password)
server.sendmail(sender_email, receiver_email, message)

Stalls, and has some reporting about error for socket connection.
I have added 587 to the UFW on my Ubuntu host. But still no luck. Any info would be helpful.

@linode-ce3ps @parlamas

Are you both on new Linode accounts, signed up since 5th November 2019?

If so, you might be being caught by this new policy: https://www.linode.com/blog/linode/a-new-policy-to-help-fight-spam/

In response to this problem, starting today, Linodes on newly created customer accounts will have connections from ports 25, 465, and 587 blocked by default. This change only affects customers who sign up starting today – if you’re already a Linode customer, no changes will be made to any existing or new Linodes.

Yes, mine is newer than that.Thank you very much for the link to the policy. I will be able to satisfy their request, so I'll get cracking on that.

OMG, I appreciate the answer but I was going crazy trying to figure out what went wrong. Something like this should be highlighted clearly during sign up

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct