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

Fix email text/plain part #297

Merged
merged 2 commits into from
Aug 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions djangoproject/core/services/mail_services.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import html2text

from django.core.mail import EmailMultiAlternatives
from django.core.validators import validate_email
Expand Down Expand Up @@ -50,7 +51,8 @@ def _send_mail_to_user(user, subject, templateName, contextData, whentrue):
template = get_template(templateName)
context = Context(contextData)
html_content = template.render(context)
send_html_mail(subject, html_content, html_content, settings.DEFAULT_FROM_EMAIL, [user.email])
text_content = html2text.html2text(html_content)
send_html_mail(subject, text_content, html_content, settings.DEFAULT_FROM_EMAIL, [user.email])


def notifyWatchers_workbegun(solution, comment, watches):
Expand Down Expand Up @@ -315,8 +317,9 @@ def notify_bitcoin_payment_was_sent_to_programmers_and_is_waiting_confirmation(p
template = get_template('email/bitcoin_payment_was_sent_to_programmers_and_is_waiting_confirmation.html')
context = Context(contextData)
html_content = template.render(context)
text_content = html2text.html2text(html_content)
subject = 'BTC %s payment received, and forwarded to programmer. Wating confirmation.' % payment.total_bitcoin_received
send_html_mail(subject, html_content, html_content, settings.DEFAULT_FROM_EMAIL, [payment.offer.sponsor.email])
send_html_mail(subject, text_content, html_content, settings.DEFAULT_FROM_EMAIL, [payment.offer.sponsor.email])
adm_subject = '[ADMIN NOTIFY] %s' % subject
notify_admin(adm_subject, html_content)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ git+git://github.com/un33k/django-emailmgr.git@7a6454346dc962ba3550821d51c311a4f

Pillow==2.2.1
mock==1.0.1
html2text==2014.7.3