If someone had this issue, I will be sincerely thankful for your help.
I'm having this error sending local email with hotmail:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/huey/consumer.py", line 169, in process_task
task_value = self.huey.execute(task)
File "/usr/local/lib/python3.6/site-packages/huey/api.py", line 357, in execute
result = task.execute()
File "/usr/local/lib/python3.6/site-packages/huey/api.py", line 842, in execute
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/huey/contrib/djhuey/__init__.py", line 108, in inner
return fn(*args, **kwargs)
File "/code/app/tasks.py", line 89, in send_email
email_message.send()
File "/usr/local/lib/python3.6/site-packages/django/core/mail/message.py", line 348, in send
return self.get_connection(fail_silently).send_messages([self])
File "/usr/local/lib/python3.6/site-packages/django/core/mail/backends/smtp.py", line 111, in send_messages
sent = self._send(message)
File "/usr/local/lib/python3.6/site-packages/django/core/mail/backends/smtp.py", line 127, in _send
self.connection.sendmail(from_email, recipients, message.as_bytes(linesep='\r\n'))
File "/usr/local/lib/python3.6/smtplib.py", line 888, in sendmail
raise SMTPDataError(code, resp)
smtplib.SMTPDataError: (432, b'4.3.2 STOREDRV.ClientSubmit; sender thread limit exceeded [Hostname=DM5PR19MB1050.namprd19.prod.outlook.com]')
ERROR process_task Unhandled exception in worker thread
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/huey/consumer.py", line 169, in process_task
task_value = self.huey.execute(task)
File "/usr/local/lib/python3.6/site-packages/huey/api.py", line 357, in execute
result = task.execute()
File "/usr/local/lib/python3.6/site-packages/huey/api.py", line 842, in execute
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/huey/contrib/djhuey/__init__.py", line 108, in inner
return fn(*args, **kwargs)
File "/code/app/tasks.py", line 89, in send_email
email_message.send()
File "/usr/local/lib/python3.6/site-packages/django/core/mail/message.py", line 348, in send
return self.get_connection(fail_silently).send_messages([self])
File "/usr/local/lib/python3.6/site-packages/django/core/mail/backends/smtp.py", line 111, in send_messages
sent = self._send(message)
File "/usr/local/lib/python3.6/site-packages/django/core/mail/backends/smtp.py", line 127, in _send
self.connection.sendmail(from_email, recipients, message.as_bytes(linesep='\r\n'))
File "/usr/local/lib/python3.6/smtplib.py", line 888, in sendmail
raise SMTPDataError(code, resp)
smtplib.SMTPDataError: (554, b'5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:050B0000, 17.43559:0000000094000000000000000000000000000000, 20.52176:140F248214004010F1030000, 20.50032:140F248285174010F1030000, 0.35180:0A00B681, 255.23226:F1030000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A00F784, 16.55847:EC000000, 17.43559:0000000068010000000000000000000000000000, 20.52176:140F2482140000100A00F736, 20.50032:140F24828517001181170000, 0.35180:00000000, 255.23226:00000000, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:140F2482, 4.21921:DC040000, 255.27962:FA000000, 255.1494:A4010000, 0.37692:05000780, 0.37948:00000600, 5.33852:00000000534D545000000000, 4.56248:DC040000, 7.40748:010000000000010B32303A44, 7.57132:00000000000000003A346638, 1.63016:32000000, 4.39640:DC040000, 8.45434:0000060075AF4541000000000000000032000000, 5.10786:0000000031352E32302E303534382E3032303A444D35505231394D42313035303A34663832663161652D373465382D343830632D623637302D34326236313339313335383200401005000780, 255.1750:0A00FC83, 255.31418:41010000, 0.22753:0A001E85, 255.21817:DC040000, 4.60547:DC040000, 0.21966:4B010000, 4.30158:DC040000 [Hostname=DM5PR19MB1050.namprd19.prod.outlook.com]')
That is my configuration on settings.py I try changing the port to 587, try with gmail account but doesn't work
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp-mail.outlook.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'mypassword'
EMAIL_PORT = 25
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
It's probably missing "Email From" variable either in settings.py or your view. Try this:
EMAIL_USE_TLS = True
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.live.com'
EMAIL_HOST_USER = '[email protected]'
DEFAULT_FROM_EMAIL = '[email protected]'
EMAIL_FROM = '[email protected]'
EMAIL_HOST_PASSWORD = 'yourpassword'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL
is used in stock Django views, but if you have your own custom one, then you can import those variables as well:
from django.conf import settings
send_mail(
mail_subject,
message,
settings.EMAIL_FROM,
[to_email],
fail_silently=False,
)