django-email-bandit icon indicating copy to clipboard operation
django-email-bandit copied to clipboard

Template for HTML alternative

Open SebCorbin opened this issue 8 years ago • 2 comments

Hello, great package!

I've successfully installed it and it works, but when sending an e-mail with HTML alternative, I have no way to know which was the original recipient (except if I look at the raw source):

I wonder if it would be possible to add a template tag or something like that for when bandit intercepts an email with HTML alternative?

SebCorbin avatar Jun 30 '16 10:06 SebCorbin

Yes it would be helpful to see this info for HTML emails as well but it's going to be harder to build a template which doesn't break the original mail. I don't have a clever solution for this myself but it would be a nice addition.

mlavin avatar Jun 30 '16 12:06 mlavin

How about something like developer puts in its template: <!-- BANDIT_PLACEHOLDER -->

And during replacement:

    if message.alternatives and len(message.alternatives):
        for alt, mimetype in message.alternatives:
            alt.replace('<!-- BANDIT_PLACEHOLDER -->', header)

SebCorbin avatar Jun 30 '16 13:06 SebCorbin