Fixed #21614 -- improved docs on configuring email for development.
This commit is contained in:
parent
bed52afee7
commit
d599b590eb
|
@ -600,8 +600,8 @@ manually open the connection, you can control when it is closed. For example::
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
|
||||||
Testing email sending
|
Configuring email for development
|
||||||
=====================
|
=================================
|
||||||
|
|
||||||
There are times when you do not want Django to send emails at
|
There are times when you do not want Django to send emails at
|
||||||
all. For example, while developing a Web site, you probably don't want
|
all. For example, while developing a Web site, you probably don't want
|
||||||
|
@ -609,13 +609,13 @@ to send out thousands of emails -- but you may want to validate that
|
||||||
emails will be sent to the right people under the right conditions,
|
emails will be sent to the right people under the right conditions,
|
||||||
and that those emails will contain the correct content.
|
and that those emails will contain the correct content.
|
||||||
|
|
||||||
The easiest way to test your project's use of email is to use the ``console``
|
The easiest way to configure email for local development is to use the
|
||||||
email backend. This backend redirects all email to stdout, allowing you to
|
:ref:`console <topic-email-console-backend>` email backend. This backend
|
||||||
inspect the content of mail.
|
redirects all email to stdout, allowing you to inspect the content of mail.
|
||||||
|
|
||||||
The ``file`` email backend can also be useful during development -- this backend
|
The :ref:`file <topic-email-file-backend>` email backend can also be useful
|
||||||
dumps the contents of every SMTP connection to a file that can be inspected
|
during development -- this backend dumps the contents of every SMTP connection
|
||||||
at your leisure.
|
to a file that can be inspected at your leisure.
|
||||||
|
|
||||||
Another approach is to use a "dumb" SMTP server that receives the emails
|
Another approach is to use a "dumb" SMTP server that receives the emails
|
||||||
locally and displays them to the terminal, but does not actually send
|
locally and displays them to the terminal, but does not actually send
|
||||||
|
@ -626,7 +626,9 @@ anything. Python has a built-in way to accomplish this with a single command::
|
||||||
This command will start a simple SMTP server listening on port 1025 of
|
This command will start a simple SMTP server listening on port 1025 of
|
||||||
localhost. This server simply prints to standard output all email headers and
|
localhost. This server simply prints to standard output all email headers and
|
||||||
the email body. You then only need to set the :setting:`EMAIL_HOST` and
|
the email body. You then only need to set the :setting:`EMAIL_HOST` and
|
||||||
:setting:`EMAIL_PORT` accordingly, and you are set.
|
:setting:`EMAIL_PORT` accordingly. For a more detailed discussion of SMTP
|
||||||
|
server options, see the Python documentation for the :mod:`smtpd` module.
|
||||||
|
|
||||||
For a more detailed discussion of testing and processing of emails locally,
|
For information about unit-testing the sending of emails in your
|
||||||
see the Python documentation for the :mod:`smtpd` module.
|
application, see the :ref:`topics-testing-email` section of :doc:`Testing
|
||||||
|
Django applications </topics/testing/overview>`.
|
||||||
|
|
Loading…
Reference in New Issue