Ability to send emails with empty message body.

This commit is contained in:
Dominic König
2013-08-22 22:56:23 +02:00
parent 5d67db3bfd
commit bc03ef84fc
+2 -2
View File
@@ -429,13 +429,13 @@ class Mail(object):
html = html.decode(encoding).encode('utf-8') html = html.decode(encoding).encode('utf-8')
# Construct mime part only if needed # Construct mime part only if needed
if text and html: if text is not None and html:
# We have text and html we need multipart/alternative # We have text and html we need multipart/alternative
attachment = MIMEMultipart.MIMEMultipart('alternative') attachment = MIMEMultipart.MIMEMultipart('alternative')
attachment.attach(MIMEText.MIMEText(text, _charset='utf-8')) attachment.attach(MIMEText.MIMEText(text, _charset='utf-8'))
attachment.attach( attachment.attach(
MIMEText.MIMEText(html, 'html', _charset='utf-8')) MIMEText.MIMEText(html, 'html', _charset='utf-8'))
elif text: elif text is not None:
attachment = MIMEText.MIMEText(text, _charset='utf-8') attachment = MIMEText.MIMEText(text, _charset='utf-8')
elif html: elif html:
attachment = \ attachment = \