diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-01-29 23:40:57 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-01-29 23:40:57 +0000 |
| commit | 2dce7064f4b249c269886a68852abcf9198a7438 (patch) | |
| tree | 49f6d72bb691f170d86c51d60ce604c18c297821 /docs | |
| parent | c3df5d96d283e2ed9cd37047e1e3f3d55bbf05b9 (diff) | |
[1.0.X] Fixed #8638 -- Added documentation on how to redirect email to a dummy server for testing purposes. Thanks to Rob Hudson and Marc Fargas for their work on the draft for this change.
Merge of r9793 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9798 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/email.txt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/topics/email.txt b/docs/topics/email.txt index b44ab35a5b..c80a035b53 100644 --- a/docs/topics/email.txt +++ b/docs/topics/email.txt @@ -350,3 +350,29 @@ send out, you could send this with:: connection = SMTPConnection() # Use default settings for connection messages = get_notification_email() connection.send_messages(messages) + +Testing e-mail sending +---------------------- + +The are times when you do not want Django to send e-mails at all. For example, +while developing a website, you probably don't want to send out thousands of +e-mails -- but you may want to validate that e-mails will be sent to the right +people under the right conditions, and that those e-mails will contain the +correct content. + +The easiest way to test your project's use of e-mail is to use a "dumb" e-mail +server that receives the e-mails locally and displays them to the terminal, +but does not actually send anything. Python has a built-in way to accomplish +this with a single command:: + + python -m smtpd -n -c DebuggingServer localhost:1025 + +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. + +For more entailed testing and processing of e-mails locally, see the Python +documentation on the `SMTP Server`_. + +.. _SMTP Server: http://docs.python.org/library/smtpd.html |
