Ticket #8638: 8638.2.diff

File 8638.2.diff, 1.3 KB (added by Rob Hudson <treborhudson@…>, 7 years ago)

Some edits and additions to first patch.

  • docs/topics/email.txt

    diff --git a/docs/topics/email.txt b/docs/topics/email.txt
    index b44ab35..ef914d3 100644
    a b send out, you could send this with:: 
    350350    connection = SMTPConnection()   # Use default settings for connection
    351351    messages = get_notification_email()
    352352    connection.send_messages(messages)
     354Preventing or testing e-mails
     357The are times when you do not want Django to send e-mails at all, i.e.
     358during development, or you would like to quickly test e-mail generation
     359and output.  The least intrusive way to do so is to use a "dumb" e-mail
     360server that receives the e-mails locally and displays them, but does not
     361actually send anything.
     363Python has a built-in way to accomplish this with a single command::
     365    python -m smtpd -n -c DebuggingServer localhost:1025
     367This command will start a simple SMTP server listening on port 1025 of
     368localhost.  This server simply prints to standard output all email
     369headers and the email body.  You then only need to set the
     370:setting:`EMAIL_HOST` and :setting:`EMAIL_PORT` accordingly, and you are
     373For more entailed testing and processing of e-mails locally, see the
     374Python documentation on the `SMTP Server`_.
     376.. _SMTP Server: http://docs.python.org/library/smtpd.html
Back to Top