I'm trying to schedule an asynchronous email job. I'm using django-rq as the queueing mechanism. I've tried numerous fixes such as changing the password, ensuring that it's correct etc. I can manually sending SMTP via REPL.
Update #1: the settings are being being picked up correctly by the worker as far as I can ascertain. The job correctly picks up the correct value for settings.DEFAULT_FROM_EMAIL
and has the correct email address set as an arg for send_mail.
The following code works successfully (no django-rq):
send_mail(
newClaim.linkedOffer.commsPromoHeadline,
msg_plain,
settings.DEFAULT_FROM_EMAIL,
[newRecipient.email],
html_message=msg_html,
)
whilst the following code generates an SMTP authentication error (traceback lower down):
django_rq.enqueue(
send_mail,
newClaim.linkedOffer.commsPromoHeadline,
msg_plain,
settings.DEFAULT_FROM_EMAIL,
[newRecipient.email],
html_message=msg_html,
)
traceback:
Traceback (most recent call last):
File "/home/user1/webapps/dev_django_platform/ENV/lib/python2.7/site-packages/rq/worker.py", line 568, in perform_job
rv = job.perform()
File "/home/user1/webapps/dev_django_platform/ENV/lib/python2.7/site-packages/rq/job.py", line 495, in perform
self._result = self.func(*self.args, **self.kwargs)
File "/home/user1/webapps/dev_django_platform/lib/python2.7/Django-1.7.7-py2.7.egg/django/core/mail/__init__.py", line 62, in send_mail
return mail.send()
File "/home/user1/webapps/dev_django_platform/lib/python2.7/Django-1.7.7-py2.7.egg/django/core/mail/message.py", line 286, in send
return self.get_connection(fail_silently).send_messages([self])
File "/home/user1/webapps/dev_django_platform/lib/python2.7/Django-1.7.7-py2.7.egg/django/core/mail/backends/smtp.py", line 92, in send_messages
new_conn_created = self.open()
File "/home/user1/webapps/dev_django_platform/lib/python2.7/Django-1.7.7-py2.7.egg/django/core/mail/backends/smtp.py", line 59, in open
self.connection.login(self.username, self.password)
File "/usr/local/lib/python2.7/smtplib.py", line 622, in login
raise SMTPAuthenticationError(code, resp)
SMTPAuthenticationError: (535, '5.7.3 Authentication unsuccessful')
Why is is throwing an exception and how can I fix it?