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 I send email with post office, in case of connection error, two attempts are done, and two same errors are raised.
This is confusing because we can think post office try so send email twice (and it's not the case).
I found the code where is done, and I don't understand why it's done like that.
post_office/mail.py:257
def send(email):
try:
email. Dispatch(log_level=log_level, commit=False,
disconnect_after_delivery=False)
sent_emails.append(email)
logger.debug('Successfully sent email #%d' % email.id)
except Exception as e:
logger.exception('Failed to send email #%d' % email.id)
failed_emails.append((email, e))
# Prepare emails before we send these to threads for sending
# So we don't need to access the DB from within threads
for email in emails:
# Sometimes this can fail, for example when trying to render
# email from a faulty Django template
try:
email.prepare_email_message()
except Exception as e:
logger.exception('Failed to prepare email #%d' % email.id)
failed_emails.append((email, e))
number_of_threads = min(get_threads_per_process(), email_count)
pool = ThreadPool(number_of_threads)
pool. Map(send, emails)
Why we try so send mail which raise exception on the preparation? Should we pop them of the email array or create an array "email_prepared" to give to the send function?
The text was updated successfully, but these errors were encountered:
Hello,
When I send email with post office, in case of connection error, two attempts are done, and two same errors are raised.
This is confusing because we can think post office try so send email twice (and it's not the case).
I found the code where is done, and I don't understand why it's done like that.
post_office/mail.py:257
Why we try so send mail which raise exception on the preparation? Should we pop them of the email array or create an array "email_prepared" to give to the send function?
The text was updated successfully, but these errors were encountered: