Refs #28196 -- Removed mentions of bytestrings for EmailMessage
With Python 3, there are no more reasons to special-case EmailMessage arguments which should be plain strings.
This commit is contained in:
parent
d3209bf09c
commit
d4d812cb56
|
@ -204,10 +204,6 @@ class EmailMessage:
|
||||||
"""
|
"""
|
||||||
Initialize a single email message (which can be sent to multiple
|
Initialize a single email message (which can be sent to multiple
|
||||||
recipients).
|
recipients).
|
||||||
|
|
||||||
All string arguments used to create the message can be strings
|
|
||||||
or UTF-8 bytestrings. The SafeMIMEText class will handle any
|
|
||||||
necessary encoding conversions.
|
|
||||||
"""
|
"""
|
||||||
if to:
|
if to:
|
||||||
if isinstance(to, str):
|
if isinstance(to, str):
|
||||||
|
@ -427,10 +423,6 @@ class EmailMultiAlternatives(EmailMessage):
|
||||||
"""
|
"""
|
||||||
Initialize a single email message (which can be sent to multiple
|
Initialize a single email message (which can be sent to multiple
|
||||||
recipients).
|
recipients).
|
||||||
|
|
||||||
All string arguments used to create the message can be strings or UTF-8
|
|
||||||
bytestrings. The SafeMIMEText class will handle any necessary encoding
|
|
||||||
conversions.
|
|
||||||
"""
|
"""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
subject, body, from_email, to, bcc, connection, attachments,
|
subject, body, from_email, to, bcc, connection, attachments,
|
||||||
|
|
|
@ -331,28 +331,6 @@ In your development environment, you might need to add a setting to your
|
||||||
|
|
||||||
export LANG="en_US.UTF-8"
|
export LANG="en_US.UTF-8"
|
||||||
|
|
||||||
Email
|
|
||||||
=====
|
|
||||||
|
|
||||||
Django's email framework (in ``django.core.mail``) supports Unicode
|
|
||||||
transparently. You can use Unicode data in the message bodies and any headers.
|
|
||||||
However, you're still obligated to respect the requirements of the email
|
|
||||||
specifications, so, for example, email addresses should use only ASCII
|
|
||||||
characters.
|
|
||||||
|
|
||||||
The following code example demonstrates that everything except email addresses
|
|
||||||
can be non-ASCII::
|
|
||||||
|
|
||||||
from django.core.mail import EmailMessage
|
|
||||||
|
|
||||||
subject = 'My visit to Sør-Trøndelag'
|
|
||||||
sender = 'Arnbjörg Ráðormsdóttir <arnbjorg@example.com>'
|
|
||||||
recipients = ['Fred <fred@example.com']
|
|
||||||
body = '...'
|
|
||||||
msg = EmailMessage(subject, body, sender, recipients)
|
|
||||||
msg.attach("Une pièce jointe.pdf", "%PDF-1.4.%...", mimetype="application/pdf")
|
|
||||||
msg.send()
|
|
||||||
|
|
||||||
Form submission
|
Form submission
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue