Opened 8 years ago

Closed 8 years ago

Last modified 4 years ago

#8638 closed Uncategorized (fixed)

Provide setting to disable e-mail sending

Reported by: Marc Fargas Owned by: Marc Fargas
Component: Core (Mail) Version: master
Severity: Normal Keywords:
Cc: treborhudson@…, orzel@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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 (2)

8638.diff (1.0 KB) - added by Marc Fargas 8 years ago.
Remember English is not my native language ;)
8638.2.diff (1.3 KB) - added by Rob Hudson <treborhudson@…> 8 years ago.
Some edits and additions to first patch.

Download all attachments as: .zip

Change History (20)

comment:1 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(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.

comment:2 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: closedreopened

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

comment:3 Changed 8 years ago by Rob Hudson <treborhudson@…>

Cc: treborhudson@… added

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.

comment:4 Changed 8 years ago by Marc Fargas

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 ;)

comment:5 Changed 8 years ago by Thomas Capricelli

Cc: orzel@… added

+1 for this one

comment:6 in reply to:  4 Changed 8 years ago by Rob Hudson <treborhudson@…>

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.

comment:7 Changed 8 years ago 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 :)

comment:8 Changed 8 years ago by Luke Plant

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.

comment:9 Changed 8 years ago by Luke Plant

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'

comment:10 Changed 8 years ago by Rob Hudson

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.

comment:11 Changed 8 years ago by Russell Keith-Magee

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.

comment:12 Changed 8 years ago by Marc Fargas

Triage Stage: UnreviewedAccepted

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

comment:13 Changed 8 years ago by Rob Hudson <treborhudson@…>

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.

Changed 8 years ago by Marc Fargas

Attachment: 8638.diff added

Remember English is not my native language ;)

comment:14 Changed 8 years ago by Marc Fargas

Owner: changed from nobody to Marc Fargas
Status: reopenednew

Changed 8 years ago by Rob Hudson <treborhudson@…>

Attachment: 8638.2.diff added

Some edits and additions to first patch.

comment:15 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(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.

comment:16 Changed 8 years ago by Russell Keith-Magee

(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.

comment:17 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:18 Changed 4 years ago by anonymous

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

This can now be done by selecting the dummy email backend: https://docs.djangoproject.com/en/dev/topics/email/#dummy-backend

Note: See TracTickets for help on using tickets.
Back to Top