When trying to send via. The /manage.py shell takes several minutes to send one email. When I try to send a confirmation email to the user after submitting the form in the browser, the browser disconnects from 504, but the email is ultimately sent. What could be?
settings.py
... EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = ' myemail@gmail.com ' EMAIL_PORT = 587 EMAIL_USE_TLS = True DEFAULT_FROM_EMAIL = EMAIL_HOST_USER EMAIL_HOST_PASSWORD = os.environ.get('PASSWORD') ...
views.py
class SignUpView(CreateView): model = User template_name = 'eventMap/register.html' form_class = RegistrationForm success_url="/" def form_valid(self, form): form.save() username = form.cleaned_data['username'] email = form.cleaned_data['email'] salt = hashlib.sha1(str(random.random())).hexdigest()[:5] activation_key = hashlib.sha1(salt+email).hexdigest() key_expires = datetime.datetime.today() + datetime.timedelta(2)
I came across this post about something similar, but the logs don't mention anything about an unqualified host name, etc. /var/log/mail.log
Jul 27 16:26:04 django postfix/qmgr[5975]: CAF7C1226F2: from=<>, size=3063, nrcpt=1 (queue active) Jul 27 16:26:34 django postfix/smtp[12874]: connect to example.com[2606:2800:220:1:248:1893:25c8:1946]:25: Connection timed out Jul 27 16:27:04 django postfix/smtp[12874]: connect to example.com[93.184.216.34]:25: Connection timed out Jul 27 16:27:04 django postfix/smtp[12874]: CAF7C1226F2: to=< myemail@example.com >, relay=none, delay=368178, delays=368118/0.02/60/0, dsn=4.4.1, status=deferred (connect to example.com[93.184.216.34]:25: Connection timed out)
Chuie source share