Re: Django won't send 500 or 404 emails, but django.core.mail.EmailMessage and django.utils.log.AdminEmailHandler work

2014-03-01 Thread benjaoming
I've run into this issue twice... both times I spent hours and finally 
found the error and was in tears... especially the second time I did it :)

I've made custom view handlers in urls.py like these:

handler500 = 'myproject.views.server_error'
handler404 = 'myproject.views.page_not_found'

However, my 404 view extended the 500 and did not set a 404 response code 
on the response object.. thus, no 404 mails from the middleware.

Idiotic, but true :)

Benjamin

On Friday, January 4, 2013 2:46:37 PM UTC+1, nkryptic wrote:
>
> The 404 emails are sent via the mail_managers method, which uses emails 
> from the django.conf.settings.MANAGERS setting, as opposed to errors which 
> go to the ADMINS.  Double-check what MANAGERS (and ADMINS) is actually set 
> to:
>
> $ python manage.py shell
> >>> from django.conf import settings
> >>> settings.MANAGERS
> (('Me', 'm...@example.com '),)
> >>> settings.ADMINS
> (('Me', 'm...@example.com '),)
>
>
> On Thursday, January 3, 2013 8:14:54 PM UTC-5, Jan Paricka wrote:
>>
>> Same problem here.
>>
>> 1) CommonMiddleware in place
>>
>> 2) debug = False
>>
>> 3) SEND_BROKEN_LINK_EMAILS = True
>>
>> And yet no 404 emails...
>>
>> Otherwise the app is happily emailing...
>>
>> Any thoughts?
>>
>> Thanks
>>
>> Jan
>>
>>
>> On Friday, June 24, 2011 9:56:23 PM UTC+2, Kyle Gong wrote:
>>>
>>> For some reason, I can't get my server to send 500 or 404 emails.  I 
>>> am set up to send email through gmail, and it is working properly when 
>>> I send error emails through a logger set up using 
>>> django.utils.log.AdminEmailHandler, and also when I send mail using 
>>> django.core.mail.EmailMessage. 
>>>
>>> I have DEBUG = False and SEND_BROKEN_LINK_EMAILS = True. 
>>>
>>> The server is a linode running Ubuntu 10.04, Django 1.3 and Python 
>>> 2.6.5. 
>>>
>>> Any idea where I could look to track down the problem?
>>
>>

-- 
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+unsubscr...@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/04ca5903-18cf-4f50-82b8-fc52eca55c6e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django won't send 500 or 404 emails, but django.core.mail.EmailMessage and django.utils.log.AdminEmailHandler work

2013-01-04 Thread nkryptic
The 404 emails are sent via the mail_managers method, which uses emails 
from the django.conf.settings.MANAGERS setting, as opposed to errors which 
go to the ADMINS.  Double-check what MANAGERS (and ADMINS) is actually set 
to:

$ python manage.py shell
>>> from django.conf import settings
>>> settings.MANAGERS
(('Me', 'm...@example.com'),)
>>> settings.ADMINS
(('Me', 'm...@example.com'),)


On Thursday, January 3, 2013 8:14:54 PM UTC-5, Jan Paricka wrote:
>
> Same problem here.
>
> 1) CommonMiddleware in place
>
> 2) debug = False
>
> 3) SEND_BROKEN_LINK_EMAILS = True
>
> And yet no 404 emails...
>
> Otherwise the app is happily emailing...
>
> Any thoughts?
>
> Thanks
>
> Jan
>
>
> On Friday, June 24, 2011 9:56:23 PM UTC+2, Kyle Gong wrote:
>>
>> For some reason, I can't get my server to send 500 or 404 emails.  I 
>> am set up to send email through gmail, and it is working properly when 
>> I send error emails through a logger set up using 
>> django.utils.log.AdminEmailHandler, and also when I send mail using 
>> django.core.mail.EmailMessage. 
>>
>> I have DEBUG = False and SEND_BROKEN_LINK_EMAILS = True. 
>>
>> The server is a linode running Ubuntu 10.04, Django 1.3 and Python 
>> 2.6.5. 
>>
>> Any idea where I could look to track down the problem?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JP53pwsFR7MJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django won't send 500 or 404 emails, but django.core.mail.EmailMessage and django.utils.log.AdminEmailHandler work

2013-01-03 Thread Jan Paricka
Same problem here.

1) CommonMiddleware in place

2) debug = False

3) SEND_BROKEN_LINK_EMAILS = True

And yet no 404 emails...

Otherwise the app is happily emailing...

Any thoughts?

Thanks

Jan


On Friday, June 24, 2011 9:56:23 PM UTC+2, Kyle Gong wrote:
>
> For some reason, I can't get my server to send 500 or 404 emails.  I 
> am set up to send email through gmail, and it is working properly when 
> I send error emails through a logger set up using 
> django.utils.log.AdminEmailHandler, and also when I send mail using 
> django.core.mail.EmailMessage. 
>
> I have DEBUG = False and SEND_BROKEN_LINK_EMAILS = True. 
>
> The server is a linode running Ubuntu 10.04, Django 1.3 and Python 
> 2.6.5. 
>
> Any idea where I could look to track down the problem?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/IBt4bGCTyUkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django won't send 500 or 404 emails, but django.core.mail.EmailMessage and django.utils.log.AdminEmailHandler work

2011-06-27 Thread Russell Keith-Magee
On Mon, Jun 27, 2011 at 8:02 PM, Russell Keith-Magee
 wrote:
> On Mon, Jun 27, 2011 at 7:02 AM, Kyle Gong  wrote:
>> I was trying to avoid setting up a mail server by just sending through
>> gmail's SMTP server. It is sending correctly through
>> django.utils.log.AdminEmailHandler and it was my understanding that they
>> worked through the same mechanisms?
>
> My apologies -- I didn't register that you were using connecting
> directly to GMail's servers to send mail.
>
> You haven't provided your mail settings, so it's impossible to know
> exactly what is going wrong, but my best guess would be that you don't
> have the EMAIL_USE_TLS setting enabled. GMail's servers use TLS to
> provide on-the-wire security, but Django has this turned off by
> default (since most mail servers don't enable TLS by default).
>
> As far as debugging this problem goes -- my advice would be to start
> lower in the stack. I can guarantee that if your email configuration
> is right, then 404 mails will be sent -- the real issue is whether the
> email configuration is correct. To verify this, use the mail APIs
> directly. From a Python prompt on your sever:
>
 from django.core import mail
 mail.send_mail("A subject", "This is the message", "m...@example.com", 
 ["recipi...@example.com"])
>
> substituting "m...@example.com" with your own address, and
> "recipi...@example.com" with another email address you can test with.
> This call should return 1, indicating that 1 email was sent. If it
> doesn't, or it raises an error, you should get some indication of what
> has gone wrong.

... and I've just re-read your original message, and realized that
you've already done this.

/me looks sheepish

So, If DEBUG = False, and SEND_BROKEN_LINK_EMAILS = True, then you
should be getting emails on 404s.

Trying to think of some other reasons you might not be getting error emails...

You wont be getting 500 emails if:
 * you have a custom 500 handler, or
 * if DEBUG_PROPAGATE_EXCEPTIONS is enabled

You won't be getting 404 messages if
 * the common middleware isn't enabled
 * the URLs you're hitting match the values in IGNORABLE_404_STARTS,
IGNORABLE_404_ENDS or IGNORABLE_404_URLS
 * Your user agent isn't settings a HTTP_REFERER header
 * Your user agent hasn't got a HTTP_REFERER header that matches the
domain of your server

Hope this is slightly more helpful than my last two attempts...

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django won't send 500 or 404 emails, but django.core.mail.EmailMessage and django.utils.log.AdminEmailHandler work

2011-06-27 Thread Russell Keith-Magee
On Mon, Jun 27, 2011 at 7:02 AM, Kyle Gong  wrote:
> I was trying to avoid setting up a mail server by just sending through
> gmail's SMTP server. It is sending correctly through
> django.utils.log.AdminEmailHandler and it was my understanding that they
> worked through the same mechanisms?

My apologies -- I didn't register that you were using connecting
directly to GMail's servers to send mail.

You haven't provided your mail settings, so it's impossible to know
exactly what is going wrong, but my best guess would be that you don't
have the EMAIL_USE_TLS setting enabled. GMail's servers use TLS to
provide on-the-wire security, but Django has this turned off by
default (since most mail servers don't enable TLS by default).

As far as debugging this problem goes -- my advice would be to start
lower in the stack. I can guarantee that if your email configuration
is right, then 404 mails will be sent -- the real issue is whether the
email configuration is correct. To verify this, use the mail APIs
directly. From a Python prompt on your sever:

>>> from django.core import mail
>>> mail.send_mail("A subject", "This is the message", "m...@example.com", 
>>> ["recipi...@example.com"])

substituting "m...@example.com" with your own address, and
"recipi...@example.com" with another email address you can test with.
This call should return 1, indicating that 1 email was sent. If it
doesn't, or it raises an error, you should get some indication of what
has gone wrong.

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django won't send 500 or 404 emails, but django.core.mail.EmailMessage and django.utils.log.AdminEmailHandler work

2011-06-26 Thread Kyle Gong
I was trying to avoid setting up a mail server by just sending through
gmail's SMTP server. It is sending correctly through
django.utils.log.AdminEmailHandler and it was my understanding that they
worked through the same mechanisms?
On Jun 24, 2011 6:58 PM, "Russell Keith-Magee" 
wrote:
> On Saturday, June 25, 2011, Kyle Gong  wrote:
>> For some reason, I can't get my server to send 500 or 404 emails.  I
>> am set up to send email through gmail, and it is working properly when
>> I send error emails through a logger set up using
>> django.utils.log.AdminEmailHandler, and also when I send mail using
>> django.core.mail.EmailMessage.
>>
>> I have DEBUG = False and SEND_BROKEN_LINK_EMAILS = True.
>>
>> The server is a linode running Ubuntu 10.04, Django 1.3 and Python
>> 2.6.5.
>>
>> Any idea where I could look to track down the problem?
>
> My first guess, since you haven't mentioned that you've done this
> step: have you configured your Linode to send mail? Unless you have a
> mail server installed and configured, you won't be able to send mail.
>
> apt-get install postfix
>
> Should be all you need to do.
>
> 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
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django won't send 500 or 404 emails, but django.core.mail.EmailMessage and django.utils.log.AdminEmailHandler work

2011-06-24 Thread Russell Keith-Magee
On Saturday, June 25, 2011, Kyle Gong  wrote:
> For some reason, I can't get my server to send 500 or 404 emails.  I
> am set up to send email through gmail, and it is working properly when
> I send error emails through a logger set up using
> django.utils.log.AdminEmailHandler, and also when I send mail using
> django.core.mail.EmailMessage.
>
> I have DEBUG = False and SEND_BROKEN_LINK_EMAILS = True.
>
> The server is a linode running Ubuntu 10.04, Django 1.3 and Python
> 2.6.5.
>
> Any idea where I could look to track down the problem?

My first guess, since you haven't mentioned that you've done this
step: have you configured your Linode to send mail? Unless you have a
mail server installed and configured, you won't be able to send mail.

apt-get install postfix

Should be all you need to do.

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django won't send 500 or 404 emails, but django.core.mail.EmailMessage and django.utils.log.AdminEmailHandler work

2011-06-24 Thread Kyle Gong
For some reason, I can't get my server to send 500 or 404 emails.  I
am set up to send email through gmail, and it is working properly when
I send error emails through a logger set up using
django.utils.log.AdminEmailHandler, and also when I send mail using
django.core.mail.EmailMessage.

I have DEBUG = False and SEND_BROKEN_LINK_EMAILS = True.

The server is a linode running Ubuntu 10.04, Django 1.3 and Python
2.6.5.

Any idea where I could look to track down the problem?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.