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

guess attachment mimetype in Django email backend if not provided #115

Merged
merged 4 commits into from
May 3, 2016

Conversation

HugoArts
Copy link
Contributor

Hello,

This is an issue I ran into while using django-post-office. The django EmailMessage.attach method does not require you to submit a mimetype, stating that it is guessed if not provided. Unfortunately the django-post-office API does not support specifying a mime type, meaning I have no choice but to rely on the guessing mechanism. Long story short, I cannot currently attach any files to my emails.

The email backend would normally let the EmailMessage class do this when converting the email to MIME format (see the EmailMessage.message method which eventually calls EmailMessage._create_attachment). Obviously the sparkpost backend does not call any of this code.

I've duplicated django's method of guessing the mimetype into the sparkpost backend. I've also added two tests to demonstrate the problem.

@richleland richleland merged commit 05409ed into SparkPost:master May 3, 2016
@richleland
Copy link
Contributor

Thanks for the contribution @HugoArts. I'm going to get #50 merged in and then cut a release.

@richleland richleland added this to the next milestone May 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants