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

header for identifying emails in transactional email services #57

Closed
davidszotten opened this issue Apr 14, 2016 · 6 comments
Closed

header for identifying emails in transactional email services #57

davidszotten opened this issue Apr 14, 2016 · 6 comments

Comments

@davidszotten
Copy link
Contributor

Hi,

I use service to send transactional emails. Among other things, they provide a webhook where they post me messages about failed sends. When I receive such messages, it would be nice to be able to match messages up to the corresponding record in the mailer message log

i was thinking that one way to achieve this would be to give messages a uuid when saving them, and including this in a custom email header (don't want to use e.g. pk, since that leaks info)

is this something that would be interesting to this project? (would be happy to contribute implementation but only if it has a chance of getting accepted)

also open to other suggestions on how to do this

best,
david

@ossanna16
Copy link
Contributor

@lukeman What do you think?

@spookylukey
Copy link
Contributor

Is this a feature that belongs in django-mailer? It seems like it could be implemented completely independently, I can't see how it fits. It sounds like something that would be useful for any email backend.

@davidszotten
Copy link
Contributor Author

well it's django-mailer that stores the messages in the db. this proposal includes an addition to that data model (to let me find a message by reference without unpickling every entry in the db to search the headers)

@spookylukey
Copy link
Contributor

I understand.

Adding a custom email header to the DB schema sounds like building in support for a very specific need.

I would be happier if this was implemented as something that would be more generally useful - for example, if all the headers were stored in a query-able form. For that, I think something like a Postgre hstore or JSON field would work, but I don't know how to make it cross DB compatible.

An alternative would be to use something like the Message-ID field (See http://www.faqs.org/rfcs/rfc2822.html). This would be a more generally recognised way of identifying specific messages. You should be able to use this field for your purposes. I would be happy with this being added as a DB field.

@davidszotten
Copy link
Contributor Author

storing Message-ID seems like a reasonable idea. Slightly tricky since (at least the django smtp backend) only generates and sets this just before sending, and then throws it away. See workaround in ensure_message_id in #58. Not sure what i think about that, but thought actual code might aid this discussion. There might be better ways around this issue.

@spookylukey
Copy link
Contributor

This is implemented and merged now, from #58

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

3 participants