Skip to content

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

@jaap3

Description

@jaap3

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions