Django

Code

Ticket #8638 (closed: fixed)

Opened 2 years ago

Last modified 1 year ago

Provide setting to disable e-mail sending

Reported by: telenieko Assigned to: telenieko
Milestone: Component: django.core.mail
Version: SVN Keywords:
Cc: treborhudson@gmail.com, orzel@freehackers.org Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

When running the development server with live data, it would be nice to have a setting like: settings.SEND_EMAIL to disable all e-mail sending in django (just as the test runner does)

So you do not accidentaly start sending mails :))

No need to have the test runner outbox :)

Attachments

8638.diff (1.0 kB) - added by telenieko on 01/20/09 10:09:34.
Remember English is not my native language ;)
8638.2.diff (1.3 kB) - added by Rob Hudson <treborhudson@gmail.com> on 01/20/09 23:42:14.
Some edits and additions to first patch.

Change History

08/29/08 00:15:51 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [8695]) Fixed #8638 -- Show by example that the File.name attribute includes the upload directory as well as the filename. Patch from Ramiro Morales.

08/29/08 00:16:43 changed by mtredinnick

  • status changed from closed to reopened.
  • needs_better_patch changed.
  • resolution deleted.
  • needs_tests changed.
  • needs_docs changed.

Whoops.. typo in commit message. Ignore the above commit.

09/19/08 14:01:42 changed by Rob Hudson <treborhudson@gmail.com>

  • cc set to treborhudson@gmail.com.

Having the email get written to stdout might be a nice option for testing emails or seeing what would get sent vs. shutting it off completely.

(follow-up: ↓ 6 ) 09/19/08 18:06:11 changed by telenieko

I was thinking more in what the Testclient does now, having an "outbox" to read from. Printing on stdout can be bad. Imagine you are testing something that sends, ie: 100 mails in a row. You can't check this. But you also *dont want* those mails to go out ;)

09/20/08 18:14:30 changed by orzel

  • cc changed from treborhudson@gmail.com to treborhudson@gmail.com, orzel@freehackers.org.

+1 for this one

(in reply to: ↑ 4 ) 09/20/08 18:20:54 changed by Rob Hudson <treborhudson@gmail.com>

Replying to telenieko:

I was thinking more in what the Testclient does now, having an "outbox" to read from. Printing on stdout can be bad. Imagine you are testing something that sends, ie: 100 mails in a row. You can't check this. But you also *dont want* those mails to go out ;)

Right... I misunderstood this bug and thought it wanted to discard all emails. The outbox idea is much better than stdout, I agree.

09/25/08 21:43:17 changed by dthole

Personally, I feel that stdout would be a wonderful option actually. While the email box is awesome, we need to create a bit of code to check that box for the email. While..well, it's not a pain, it'd be nice to just switch to the stdout (server) and see the email pop up there. I just was running into this today, but feel honestly that this sort of feature would be really helpful.

Kinda +1ing this as well, but having an option if we want to suppress stdout in the case of telenieko's feelings makes sense, for the 1-2 emails that I'm working with stdout would be optimal. Having an option for both would be great :)

11/25/08 10:10:13 changed by lukeplant

Why not just use fakemail or something similar? It will dump emails to files in the directory of your choice, so they don't get sent out, but they can be inspected without special tools if necessary. I don't see the need to include something like this in Django when there are perfectly good existing solutions.

11/25/08 10:25:36 changed by lukeplant

BTW, if you want to monitor the directory fastmail dumps into, you could do that with some simple scripting e.g.

watch 'find /path/to/fakemail/dir -type f | xargs cat'

11/25/08 10:28:19 changed by robhudson

I've started a thread on the Django Developers list: http://groups.google.com/group/django-developers/browse_thread/thread/e7c7228e1f12f174

Python does have it's own built-in version of "fakemail":

python /path/to/python/lib/python2.5/smtpd.py -n -c DebuggingServer localhost:1025

But there may be some ways to make it a little more nicely integrated that the discussion thread brings up.

01/15/09 17:19:35 changed by russellm

Following some the mailing list discussion and some conversations with Rob Hudson, it looks like the best option here will be to fix this with documentation. There are some easy tricks you can do with Python's included batteries to fake a debug mail server:

python -m smtpd -n -c DebuggingServer localhost:1025

If you need more than this, you can hunt down fakemail or similar product.

01/20/09 05:48:47 changed by telenieko

  • stage changed from Unreviewed to Accepted.

Anyone has done anywork in the documentation? (to start it).

01/20/09 09:45:15 changed by Rob Hudson <treborhudson@gmail.com>

I have it on my list of things to do, but have not yet started anything. Feel free to jump in and I'd be happy to post comments or update a patch if needed.

01/20/09 10:09:34 changed by telenieko

  • attachment 8638.diff added.

Remember English is not my native language ;)

01/20/09 10:10:26 changed by telenieko

  • owner changed from nobody to telenieko.
  • status changed from reopened to new.

01/20/09 23:42:14 changed by Rob Hudson <treborhudson@gmail.com>

  • attachment 8638.2.diff added.

Some edits and additions to first patch.

01/29/09 06:31:13 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(In [9793]) 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.

01/29/09 17:40:57 changed by russellm

(In [9798]) [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.

02/25/09 13:51:44 changed by

  • milestone deleted.

Milestone post-1.0 deleted


Add/Change #8638 (Provide setting to disable e-mail sending)




Change Properties
Action