You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending a lot of mails with django-celery-email as backend, I often get an error in my celery logs, that there were too many concurrent connections.
with mail.get_connection() as connection:
for recipient in set(recipients):
email = EmailMessage(subject, content, sender, [recipient],
headers=headers,
connection=connection, **kwargs)
if attachments is not None:
for attach in attachments:
email.attach_file(attach)
try:
email.send(fail_silently=True)
except Exception as e:
print("Error when sending mail:", e)
failed = True
else:
succeeded = True
I was expecting that this opens one connection and sends all emails using this one connection. Is this a wrong assumption? How can I force the mail backend to only use one single connection?
The text was updated successfully, but these errors were encountered:
When sending a lot of mails with
django-celery-email
as backend, I often get an error in my celery logs, that there were too many concurrent connections.I have set
EMAIL_BACKEND
accordingly:And I am sending emails like so:
I was expecting that this opens one connection and sends all emails using this one connection. Is this a wrong assumption? How can I force the mail backend to only use one single connection?
The text was updated successfully, but these errors were encountered: