Last active
March 8, 2019 00:24
-
-
Save leonardotrp/ea6546b43c3c9da8f9017aa12c14ba36 to your computer and use it in GitHub Desktop.
Send mail with custom EMAIL_FROM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from mailing import mail | |
| def send(): | |
| mail.send_email(recipients=[[email protected]], \ | |
| subject='[Test Email] Subject', \ | |
| text_content='This is a test', \ | |
| from_email=settings.DEFAULT_FROM_EMAIL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EMAIL_HOST = 'smtp.gmail.com' | |
| EMAIL_USE_TLS = True | |
| EMAIL_PORT = 587 | |
| EMAIL_HOST_USER = '[email protected]' | |
| EMAIL_HOST_PASSWORD = 'password' | |
| EMAIL_BACKEND = 'djcelery_email.backends.CeleryEmailBackend' | |
| # https://pypi.org/project/django-mailing/ | |
| DEFAULT_FROM_EMAIL = 'noreply@app' | |
| MAILING_USE_CELERY = True |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a Django 1.8 application and it uses Celery for multiprocessing. My problem is that I can not make mail.send_message (...) use the
settings.DEFAULT_EMAIL_FROMproperty, instead ofsettings.EMAIL_HOST_USERdjcelery_mailbackenddjango.core.mailanddjango_mailingpackage.How do I personalize the sender's email?