stuck a bit, solving the problem of sending asynchronous email. I would like to use celery and django database as a backend. since now the only thing I would like to use for this queue management tool is email, I also set up django-celery email.
Following the instructions, I made such updates in the settings file:
import djcelery djcelery.setup_loader() INSTALLED_APPS += ('kombu.transport.django', 'djcelery', 'djcelery_email') BROKER_URL = 'django://' EMAIL_BACKEND = 'djcelery_email.backends.CeleryEmailBackend'
I use django SMTP by default with these settings:
EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'cs*****@gmail.com' EMAIL_HOST_PASSWORD = '*********' EMAIL_PORT = 587
I djcelery for djcelery and komby . And now, using the standard django send_mail method, the mail address is not sent.
If the EMAIL_BACKEND option EMAIL_BACKEND removed, sending emails works, but is terribly slow. IF not for speed, I would not look in line for this process in the first place.
I use the MySQL database as the database database and the error log file did not show anything when adding the task, so I assume that this part is in order. It seems to me that I missed some basic part of the installation or configuration, which can be easily noticed by an experienced celery or user djcelery , but a novice like me could miss.
UPDATE Bypass django shell:
>>> from django.core.mail import send_mail >>> from django.conf import settings >>> result = send_mail('test send', 'test_send_body_text', settings.EMAIL_HOST_USER, 'hornswf@gmail.com') >>> result[0].status u'PENDING' >>> result[0].ready() False >>> result[0].failed() False >>> result[0].info >>> result[0].result
after 5 minutes of waiting (without sending email with celery it usually takes about 10-15 seconds), I still get:
>>> result[0].status u'PENDING'
and after 15 minutes generate the last check (20 in total):
>>> result[0].status u'PENDING'
So can anyone help me on this? I firmly believe that it is simple.
Sincerely yours, Sergey Aganezov.