#34126: Exception sending EmailMessage with html_message=True
----------------------------------------+---------------------------
               Reporter:  openHBP       |          Owner:  nobody
                   Type:  Bug           |         Status:  new
              Component:  Core (Other)  |        Version:  4.1
               Severity:  Normal        |       Keywords:  send_mail
           Triage Stage:  Unreviewed    |      Has patch:  0
    Needs documentation:  0             |    Needs tests:  0
Patch needs improvement:  0             |  Easy pickings:  0
                  UI/UX:  0             |
----------------------------------------+---------------------------
 {{{
 from django.core.mail import send_mail

 send_mail(
     'Subject here',
     '<p>Here is the message.</p>',
     '[email protected]',
     ['[email protected]'],
     fail_silently=False,
     html_message=True
 )
 }}}
 {{{
 Traceback (most recent call last):
   File "zcheck/send_mail.py", line 9, in <module>
     send_mail(
   File ".venv/lib/python3.9/site-packages/django/core/mail/__init__.py",
 line 61, in send_mail
     return mail.send()
   File ".venv/lib/python3.9/site-packages/django/core/mail/message.py",
 line 284, in send
     return self.get_connection(fail_silently).send_messages([self])
   File ".venv/lib/python3.9/site-
 packages/django/core/mail/backends/smtp.py", line 109, in send_messages
     sent = self._send(message)
   File ".venv/lib/python3.9/site-
 packages/django/core/mail/backends/smtp.py", line 123, in _send
     message = email_message.message()
   File ".venv/lib/python3.9/site-packages/django/core/mail/message.py",
 line 247, in message
     msg = self._create_message(msg)
   File ".venv/lib/python3.9/site-packages/django/core/mail/message.py",
 line 440, in _create_message
     return self._create_attachments(self._create_alternatives(msg))
   File ".venv/lib/python3.9/site-packages/django/core/mail/message.py",
 line 450, in _create_alternatives
     msg.attach(self._create_mime_attachment(*alternative))
   File ".venv/lib/python3.9/site-packages/django/core/mail/message.py",
 line 365, in _create_mime_attachment
     attachment = SafeMIMEText(content, subtype, encoding)
   File ".venv/lib/python3.9/site-packages/django/core/mail/message.py",
 line 159, in __init__
     MIMEText.__init__(self, _text, _subtype=_subtype, _charset=_charset)
   File "/home/pat/.pyenv/versions/3.9.7/lib/python3.9/email/mime/text.py",
 line 42, in __init__
     self.set_payload(_text, _charset)
   File ".venv/lib/python3.9/site-packages/django/core/mail/message.py",
 line 169, in set_payload
     for line in payload.splitlines()
 AttributeError: 'bool' object has no attribute 'splitlines'
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34126>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701841e9df91a-fb677b8d-cc46-416d-818e-89926b52c95e-000000%40eu-central-1.amazonses.com.

Reply via email to