diff options
| author | Mridul Dhall <mriduldhall@Mriduls-MacBook-Pro.local> | 2025-09-10 14:31:31 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2025-09-12 18:59:58 +0200 |
| commit | b8df1eb7c2f3e6db8866d9209330b237cdd83eeb (patch) | |
| tree | 9960ab542ce1597c29e7d0dd14e342be681b2830 /docs/topics | |
| parent | adc80dd81eb70d8e11230b9603b025f0d98e1373 (diff) | |
[5.2.x] Fixed #36597 -- Corrected directives for functions from email module in docs.
Thanks Mike Edmunds for the report.
Backport of e183d6c26c8da4486c151f9ce973828e2404a796 from main.
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/email.txt | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/docs/topics/email.txt b/docs/topics/email.txt index e4a9fca330..fed6324de7 100644 --- a/docs/topics/email.txt +++ b/docs/topics/email.txt @@ -124,10 +124,10 @@ can be ``0`` or ``1`` since it can only send one message). (subject, message, from_email, recipient_list) ``fail_silently``, ``auth_user`` and ``auth_password`` have the same functions -as in :meth:`~django.core.mail.send_mail()`. +as in :func:`~django.core.mail.send_mail`. Each separate element of ``datatuple`` results in a separate email message. -As in :meth:`~django.core.mail.send_mail()`, recipients in the same +As in :func:`~django.core.mail.send_mail`, recipients in the same ``recipient_list`` will all see the other addresses in the email messages' "To:" field. @@ -154,12 +154,12 @@ The return value will be the number of successfully delivered messages. ``send_mass_mail()`` vs. ``send_mail()`` ---------------------------------------- -The main difference between :meth:`~django.core.mail.send_mass_mail()` and -:meth:`~django.core.mail.send_mail()` is that -:meth:`~django.core.mail.send_mail()` opens a connection to the mail server -each time it's executed, while :meth:`~django.core.mail.send_mass_mail()` uses +The main difference between :func:`~django.core.mail.send_mass_mail` and +:func:`~django.core.mail.send_mail` is that +:func:`~django.core.mail.send_mail` opens a connection to the mail server +each time it's executed, while :func:`~django.core.mail.send_mass_mail` uses a single connection for all of its messages. This makes -:meth:`~django.core.mail.send_mass_mail()` slightly more efficient. +:func:`~django.core.mail.send_mass_mail` slightly more efficient. ``mail_admins()`` ================= @@ -223,7 +223,7 @@ scripts generate. The Django email functions outlined above all protect against header injection by forbidding newlines in header values. If any ``subject``, ``from_email`` or ``recipient_list`` contains a newline (in either Unix, Windows or Mac style), -the email function (e.g. :meth:`~django.core.mail.send_mail()`) will raise +the email function (e.g. :func:`~django.core.mail.send_mail`) will raise ``django.core.mail.BadHeaderError`` (a subclass of ``ValueError``) and, hence, will not send the email. It's your responsibility to validate all data before passing it to the email functions. @@ -261,18 +261,18 @@ from the request's POST data, sends that to admin@example.com and redirects to The ``EmailMessage`` class ========================== -Django's :meth:`~django.core.mail.send_mail()` and -:meth:`~django.core.mail.send_mass_mail()` functions are actually thin +Django's :func:`~django.core.mail.send_mail` and +:func:`~django.core.mail.send_mass_mail` functions are actually thin wrappers that make use of the :class:`~django.core.mail.EmailMessage` class. Not all features of the :class:`~django.core.mail.EmailMessage` class are -available through the :meth:`~django.core.mail.send_mail()` and related +available through the :func:`~django.core.mail.send_mail` and related wrapper functions. If you wish to use advanced features, such as BCC'ed recipients, file attachments, or multi-part email, you'll need to create :class:`~django.core.mail.EmailMessage` instances directly. .. note:: - This is a design feature. :meth:`~django.core.mail.send_mail()` and + This is a design feature. :func:`~django.core.mail.send_mail` and related functions were originally the only interface Django provided. However, the list of parameters they accepted was slowly growing over time. It made sense to move to a more object-oriented design for email @@ -577,7 +577,7 @@ It can also be used as a context manager, which will automatically call Obtaining an instance of an email backend ----------------------------------------- -The :meth:`get_connection` function in ``django.core.mail`` returns an +The :func:`get_connection` function in ``django.core.mail`` returns an instance of the email backend that you can use. .. currentmodule:: django.core.mail @@ -656,7 +656,7 @@ The file backend writes emails to a file. A new file is created for each new session that is opened on this backend. The directory to which the files are written is either taken from the :setting:`EMAIL_FILE_PATH` setting or from the ``file_path`` keyword when creating a connection with -:meth:`~django.core.mail.get_connection`. +:func:`~django.core.mail.get_connection`. To specify this backend, put the following in your settings:: |
