diff options
| author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2013-12-13 13:19:48 -0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-12-14 11:20:38 -0500 |
| commit | d599b590ebe6e2d3a60cf033de4d81c6b963bb04 (patch) | |
| tree | c203113c326016f8c02c9494c620f1eadfc0271c /docs | |
| parent | bed52afee7a336b833c015bb8878f504cef46bd1 (diff) | |
Fixed #21614 -- improved docs on configuring email for development.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/email.txt | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/docs/topics/email.txt b/docs/topics/email.txt index d60a497fdf..058a007721 100644 --- a/docs/topics/email.txt +++ b/docs/topics/email.txt @@ -600,8 +600,8 @@ manually open the connection, you can control when it is closed. For example:: connection.close() -Testing email sending -===================== +Configuring email for development +================================= 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 @@ -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, 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`` -email backend. This backend redirects all email to stdout, allowing you to -inspect the content of mail. +The easiest way to configure email for local development is to use the +:ref:`console <topic-email-console-backend>` email backend. This backend +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 -dumps the contents of every SMTP connection to a file that can be inspected -at your leisure. +The :ref:`file <topic-email-file-backend>` email backend can also be useful +during development -- this backend dumps the contents of every SMTP connection +to a file that can be inspected at your leisure. 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 @@ -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 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 -: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, -see the Python documentation for the :mod:`smtpd` module. +For information about unit-testing the sending of emails in your +application, see the :ref:`topics-testing-email` section of :doc:`Testing +Django applications </topics/testing/overview>`. |
