On Wed, Aug 20, 2008 at 7:21 AM, Andrew D. Ball <[EMAIL PROTECTED]> wrote:
>
> I've noticed that email isn't being sent during unit tests
> in Django 1.0 beta 1.  The django.core.mail.EmailMessage.send
> method returns '1' as if it had sent 1 message successfully,
> but the SMTP server doesn't get contacted at all.  The
> same thing happens with django.core.mail.send_mail.
>
> Is this expected behavior?  Is it documented somewhere?

Yes, and yes.

http://www.djangoproject.com/documentation/testing/#e-mail-services

> What gives?  I'd like my unit tests to send emails.  It's fine
> if I have to add a setting or something, but it's not okay that
> I'm currently unable to get emails to be sent by unit tests.
>
> I have a really nice "SMTP black hole" -- an SMTP server on
> a VM that delivers mail to any email address to a local mail
> spool, so the unit tests' sending emails won't hurt anything.

Well... yes it will. It will hurt everyone that doesn't have access to
your SMTP black hole, or a black hole of their own (which isn't always
going to be easy to set up - for example, on shared hosting). It also
means that it isn't easy to check the contents of sent mail as part of
your test.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to