pmclanahan / django-celery-email

A Django email backend that uses a celery task for sending the email.
BSD 3-Clause "New" or "Revised" License
477 stars 110 forks source link

Type error for send_messages #84

Open mkaykisiz opened 2 years ago

mkaykisiz commented 2 years ago

Hello,

I'm using 2.0.0 version on my project. I have a some problems. I found this in my log file.

"Cannot reach CELERY_EMAIL_BACKEND django.core.mail.backends.smtp.EmailBackend"

And After, we add this parameter.

CELERY_EMAIL_BACKEND = 'djcelery_email.backends.CeleryEmailBackend'

After, I have a new problem.

djcelery_email_send_multiple[49d3b5a9-b1af-424c-8709-95b506d66c49]: Failed to send email message to [u'john@doe.com'], retrying. (TypeError("unsupported operand type(s) for +=: 'int' and 'list'",))

Because send_messages method of CeleryEmailBackend return to list.

https://github.com/pmclanahan/django-celery-email/blob/be1a5bb056d8acf10d33703c587c02850afd29ff/djcelery_email/tasks.py#L50

joyouscob commented 2 years ago

I am having this issue too, where you able to find a fix? I am running Django version 3.1.7, Celery 5.1.2, python 3.9.7

joyouscob commented 2 years ago

If you are still having this issue, i had to move to using django post office.. with celery

ramonakira commented 2 years ago

I ran into the same issue today. @mkaykisiz Where you able to fix this?

mkaykisiz commented 2 years ago

I ignored the "CELERY_EMAIL_BACKEND" variable. If you don't set the variable, celery using default mail backend.

ramonakira commented 2 years ago

Thanks for you response! Actually I found out what the problem is. If you put djcelery_email.backends.CeleryEmailBackend in CELERY_EMAIL_BACKEND you will create some kind of inception loop. The djcelery_email.backends.CeleryEmailBackend can only be used in EMAIL_BACKEND but any other email backend can then be used in CELERY_EMAIL_BACKEND.