emranprojects/SahaBee

Fix email sending authentication issue

Closed this issue · 1 comments

There is a celery task that emails timesheets periodically. Currently, it fails due to the change to the mail server authentication system. It may or may not be fixed by replacing the new credentials.
The error log:

[2022-01-11 23:00:01,811: ERROR/ForkPoolWorker-2] Task TASK_SEND_ACTIVE_TIMESHEETS[3e6e4745-c225-432b-93bc-3e9b0c6e2e93] raised unexpected: SMTPAuthenticationError(535, b'5.7.8 Error: authentication fail
ed: authentication failure')
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 451, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 734, in __protected_call__
    return self.run(*args, **kwargs)
  File "/sahabee/rollcall/tasks.py", line 32, in send_active_timesheets
    _send_user_timesheet(user)
  File "/sahabee/rollcall/tasks.py", line 72, in _send_user_timesheet
    message.send()
  File "/usr/local/lib/python3.8/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/local/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
    new_conn_created = self.open()
  File "/usr/local/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 69, in open
    self.connection.login(self.username, self.password)
  File "/usr/local/lib/python3.8/smtplib.py", line 734, in login
    raise last_exception
  File "/usr/local/lib/python3.8/smtplib.py", line 723, in login
    (code, resp) = self.auth(
  File "/usr/local/lib/python3.8/smtplib.py", line 646, in auth
    raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, b'5.7.8 Error: authentication failed: authentication failure')

The issue was just about a recent password change. It fixed after password cariable update...