Skip to content

Commit

Permalink
Merge pull request #297 from sim6/email-text-plain
Browse files Browse the repository at this point in the history
Fix email text/plain part
  • Loading branch information
tonylampada committed Aug 2, 2014
2 parents e0c5914 + 025e1e6 commit 5e76f50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 5e76f50

Please sign in to comment.