Friday, January 31, 2014

Problems Sending Email From Django SIte

I have my django site setup on my production server, a Debian machine with exim4 and django 1.6. I use smtp.cox.net to relay my emails from my server. 

I can send emails from the server using mutt. 

I can also send an email from a python prompt in my virtual environment on the server using this (with a different to and from address) after importing my projects settings.py file:

>>> from django.core.mail import send_mail
>>> send_mail('Subject here', 'Here is the message.', 'from@example.com', ['to@example.com'], fail_silently=False)

However, when I get an error on the site (ie self-induced), I do not get any emails from the site. I have ADMINS setup correctly per the docs. In settings.py I just have the basics - localhost and port 25 for email.

Perhaps the error I introduced was to severe (an import error is settings.py). I also tried accessing a page that does not exist, and no email.

My first question: How can I simulate/force an error on the site to get an email so I can make sure the site can send an email to the admins?

Thanks,

Mark

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEqej2OvqoZ8HSs8OrOiXUhXVWEYmDpdx_pZjedimbLajhXZaw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment