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:51:52 +0200 |
| commit | e183d6c26c8da4486c151f9ce973828e2404a796 (patch) | |
| tree | ef7a37afb518a649f1a72adef5125ec84e43aa95 /docs/topics | |
| parent | 8956ee3ce393f143696fa6c50a1153c0623003ad (diff) | |
Fixed #36597 -- Corrected directives for functions from email module in docs.
Thanks Mike Edmunds for the report.
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 140f371e65..8c89bb0ee2 100644 --- a/docs/topics/email.txt +++ b/docs/topics/email.txt @@ -133,11 +133,11 @@ can be ``0`` or ``1`` since it can only send one message). (subject, message, from_email, recipient_list) ``fail_silently``, ``auth_user``, ``auth_password`` and ``connection`` have the -same functions as in :meth:`~django.core.mail.send_mail`. They must be given +same functions as in :func:`~django.core.mail.send_mail`. They must be given as keyword arguments if used. 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. @@ -169,12 +169,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()`` ================= @@ -248,7 +248,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 :exc:`ValueError` and, hence, will not send the email. It's your responsibility to validate all data before passing it to the email functions. @@ -291,18 +291,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 @@ -675,7 +675,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. .. function:: get_connection(backend=None, *, fail_silently=False, **kwargs) @@ -756,7 +756,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:: |
