Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.0.X] Fixed #8638 -- Added documentation on how to redirect email t…

…o 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
  • Loading branch information...
commit 2dce7064f4b249c269886a68852abcf9198a7438 1 parent c3df5d9
Russell Keith-Magee authored January 29, 2009

Showing 1 changed file with 26 additions and 0 deletions. Show diff stats Hide diff stats

  1. 26  docs/topics/email.txt
26  docs/topics/email.txt
@@ -350,3 +350,29 @@ send out, you could send this with::
350 350
     connection = SMTPConnection()   # Use default settings for connection
351 351
     messages = get_notification_email()
352 352
     connection.send_messages(messages)
  353
+
  354
+Testing e-mail sending
  355
+----------------------
  356
+
  357
+The are times when you do not want Django to send e-mails at all. For example,
  358
+while developing a website, you probably don't want to send out thousands of
  359
+e-mails -- but you may want to validate that e-mails will be sent to the right
  360
+people under the right conditions, and that those e-mails will contain the
  361
+correct content.
  362
+
  363
+The easiest way to test your project's use of e-mail is to use a "dumb" e-mail
  364
+server that receives the e-mails locally and displays them to the terminal,
  365
+but does not actually send anything. Python has a built-in way to accomplish
  366
+this with a single command::
  367
+
  368
+    python -m smtpd -n -c DebuggingServer localhost:1025
  369
+
  370
+This command will start a simple SMTP server listening on port 1025 of
  371
+localhost. This server simply prints to standard output all email headers and
  372
+the email body. You then only need to set the :setting:`EMAIL_HOST` and
  373
+:setting:`EMAIL_PORT` accordingly, and you are set.
  374
+
  375
+For more entailed testing and processing of e-mails locally, see the Python
  376
+documentation on the `SMTP Server`_.
  377
+
  378
+.. _SMTP Server: http://docs.python.org/library/smtpd.html

0 notes on commit 2dce706

Please sign in to comment.
Something went wrong with that request. Please try again.