-
Notifications
You must be signed in to change notification settings - Fork 335
Open
Labels
Description
It would be nice if the message priority could be set without explicitly using django-mailer functions in the code base. For example by using a custom header in the email message.
There already is an X-Priority header, but those values don't match up with the values defined in django-mailer. It would probably also be a bad idea to reuse an existing header. But something like X-Django-Mailer-Priority could work.
Then the send_messags method on DbBackend can be tweaked to take this custom header into account (and remove it)
django-mailer/src/mailer/backend.py
Lines 15 to 17 in 2228d2b
| messages = Message.objects.bulk_create([ | |
| Message(email=email) for email in email_messages | |
| ], MESSAGES_BATCH_SIZE) |
e.g.:
messages = Message.objects.bulk_create([
Message(email=email, message.extra_headers.pop('X-Django-Mailer-Priority', PRIORITY_MEDIUM))
for email in email_messages
], MESSAGES_BATCH_SIZE)