Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting priority without using django-mailer specific functions #137

Open
jaap3 opened this issue Jan 12, 2021 · 0 comments
Open

Allow setting priority without using django-mailer specific functions #137

jaap3 opened this issue Jan 12, 2021 · 0 comments

Comments

@jaap3
Copy link
Contributor

jaap3 commented Jan 12, 2021

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)

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant