django-mailer
django-mailer copied to clipboard
Add attachment integrated features
Changes proposed in this PR:
- Added attachment options for HTML mails in send_html_mail()
- Added attachment function for plaintext mail : send_attachment_mail()
Plaintext attachment feature is in a specific function in order to keep the Django standard send_mail() syntax unchanged.
I'm not confident with your unit tests system/writing. Can someone guide me on how to write it?
Coverage decreased (-2.8%) to 83.693% when pulling e18edbf408eb5b542fa6e46d496a921aa896d8d9 on elixir-sante:master into 9b0cce811cf7414360a9365ca983dc324c709c2e on pinax:master.
django-mailer's current functionality is to provide just a mail queue. It looks like everything here can be achieved using EmailMessage, so there isn't a need for this to be in django-mailer. See also the discussion on https://github.com/pinax/django-mailer/issues/119
I probably deeply misunderstood send_html_mail() usage in this case. How can we access the EmailMessage after putting it in the mail queue, in order to add an attachment?
I probably deeply misunderstood send_html_mail() usage in this case. How can we access the EmailMessage after putting it in the mail queue, in order to add an attachment?
You add the attachment before putting it on the queue, not after. Use EmailMessage
directly, and its send()
method, don't use send_html_mail
.