summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMike Edmunds <medmunds@gmail.com>2025-07-16 15:41:57 -0700
committernessita <124304+nessita@users.noreply.github.com>2025-07-17 14:01:16 -0300
commit6320915053bbd22bee2240b80df08ed4e25235f8 (patch)
tree8ecb0b6517012f033b2e82e45b02e510f54c231b /docs
parentfc793fc303a3d516ab51bb21aa317031caabe7b4 (diff)
Refs #36163 -- Reordered EmailMessage options in docs/topics/email.txt.
Reordered the keyword-only EmailMessage parameters in the documentation to group similar options together and move rarely used options later. Used keywords for *all* parameters in EmailMessage examples to improve clarity.
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/email.txt36
1 files changed, 18 insertions, 18 deletions
diff --git a/docs/topics/email.txt b/docs/topics/email.txt
index ec87f0337b..3dce2ec38d 100644
--- a/docs/topics/email.txt
+++ b/docs/topics/email.txt
@@ -50,10 +50,10 @@ specific template and custom headers, you can use the following approach::
# Then, create a multipart email instance.
msg = EmailMultiAlternatives(
- "Subject here",
- text_content,
- "from@example.com",
- ["to@example.com"],
+ subject="Subject here",
+ body=text_content,
+ from_email="from@example.com",
+ to=["to@example.com"],
headers={"List-Unsubscribe": "<mailto:unsub@example.com>"},
)
@@ -337,14 +337,14 @@ but must be in the given order if positional arguments are used:
The following parameters must be given as keyword arguments if used:
+* ``cc``: A list or tuple of recipient addresses used in the "Cc" header
+ when sending the email.
+
* ``bcc``: A list or tuple of addresses used in the "Bcc" header when
sending the email.
-* ``connection``: An :ref:`email backend <topic-email-backends>` instance. Use
- this parameter if you are sending the ``EmailMessage`` via ``send()`` and you
- want to use the same connection for multiple messages. If omitted, a new
- connection is created when ``send()`` is called. This parameter is ignored
- when using :ref:`send_messages() <topics-sending-multiple-emails>`.
+* ``reply_to``: A list or tuple of recipient addresses used in the "Reply-To"
+ header when sending the email.
* ``attachments``: A list of attachments to put on the message. These can
be instances of :class:`~email.mime.base.MIMEBase` or
@@ -361,11 +361,11 @@ The following parameters must be given as keyword arguments if used:
caller to ensure header names and values are in the correct format for
an email message. The corresponding attribute is ``extra_headers``.
-* ``cc``: A list or tuple of recipient addresses used in the "Cc" header
- when sending the email.
-
-* ``reply_to``: A list or tuple of recipient addresses used in the "Reply-To"
- header when sending the email.
+* ``connection``: An :ref:`email backend <topic-email-backends>` instance. Use
+ this parameter if you are sending the ``EmailMessage`` via ``send()`` and you
+ want to use the same connection for multiple messages. If omitted, a new
+ connection is created when ``send()`` is called. This parameter is ignored
+ when using :ref:`send_messages() <topics-sending-multiple-emails>`.
.. deprecated:: 6.0
@@ -377,10 +377,10 @@ For example::
from django.core.mail import EmailMessage
email = EmailMessage(
- "Hello",
- "Body goes here",
- "from@example.com",
- ["to1@example.com", "to2@example.com"],
+ subject="Hello",
+ body="Body goes here",
+ from_email="from@example.com",
+ to=["to1@example.com", "to2@example.com"],
bcc=["bcc@example.com"],
reply_to=["another@example.com"],
headers={"Message-ID": "foo"},