Exim4 has two logs - main and reject.
Message from python prompt and mutt - shows activity in main, but not reject.
Message from Server 500 error with django app - no activity in main, and a message in reject -
2014-01-31 21:30:55 unqualified recipient rejected: <a> H=localhost [127.0.0.1]
That is all I have.
My settings.py files...maybe you will see something missing or mis-configured for email from a django site (I removed some sensitive information).
The first file base.py:
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'south',
'inventory',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
DEBUG = False
TEMPLATE_DEBUG = False
ROOT_URLCONF = 'inventory_project.urls'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/Phoenix'
USE_I18N = True
USE_L10N = True
USE_TZ = True
The second file base_beagle.py:
# settings/base_beagle.py
from base import *
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = 'http://192.168.5.126:7000/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = 'http://192.168.5.126:7000/media/'
The third file prod_beagle.py
# settings/prod_beagle.py
from base_beagle import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['192.168.5.126', 'localhost']
EMAIL_HOST = "localhost"
EMAIL_PORT = 25
EMAIL_SUBJECT_PREFIX = "[Django-beagle] "
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'inventory_prod',
'USER': '********',
'PASSWORD': '*******',
}
}
INTERNAL_IPS = ("127.0.0.1","192.168.5.126")
ADMINS = (('mark', 'xxx@xxxxxxxxxx.xxx'))
LOGIN_URL = '/mom/inventory/login/'
WSGI_APPLICATION = "inventory_project.wsgi.application"
Thanks,
Mark
On Fri, Jan 31, 2014 at 8:49 PM, m1chael <mykhul@gmail.com> wrote:
can you tail a mail server log file, while trying to send a django
e-mail, and see what happens? also take a look at a log file for
command line and mutt.... do a comparison of all. maybe that will help
On Fri, Jan 31, 2014 at 10:35 PM, Mark Phillips
> https://groups.google.com/d/msgid/django-users/CAEqej2Oh2UKAic%3DS1FTNpsXaO474JrYzEH3Co%3DBPvpAMifEc5w%40mail.gmail.com.<mark@phillipsmarketing.biz> wrote:
> Thank-you for your response...However,
>
> 1. I can send email from the command line and from mutt.
>
> 2. I can send email from a python prompt using the settings.py in my app.
>
> These two facts tell me the mail server is configured properly.
>
> 3. Only my django app cannot send email.
>
> This fact leads me to believe my django app is mis-configured for sending
> email. In all other aspects, my app works as designed.
>
> Do you have any other helpful suggestions?
>
> Mark
>
>
> On Fri, Jan 31, 2014 at 7:26 PM, m1chael <mykhul@gmail.com> wrote:
>>
>> Your mail server needs configuring.
>>
>> On Fri, Jan 31, 2014 at 8:15 PM, Mark Phillips
>> <mark@phillipsmarketing.biz> wrote:
>> > A follow up. After hitting send, I realized how to simulate an error - I
>> > asked for a page with a nonexistent id. Like the polls example in the
>> > django
>> > tutorial, I used an url with a poll_id that does not exist in my site. I
>> > got
>> > a Server Error (500) page, but no email. I looked in the exim4 reject
>> > log
>> > and found:
>> >
>> > 2014-01-31 18:07:04 unqualified recipient rejected: <a> H=localhost
>> > [127.0.0.1]
>> >
>> > I googled this error and have not had any luck figuring it out. Since I
>> > can
>> > send email from the command line and a python script with the same
>> > settings.py file as my site, could I be missing something in the django
>> > setup for sending emails to admins when there is a site error?
>> >
>> > All I have in settings.py for email is localhost, port 25, and admins
>> > addresses. Do I need something else? Some module or middleware
>> > thing-a-ma-bob? I just have the stock modules and middleware that django
>> > created with a new project. I haven't found anything in the django docs
>> > that
>> > point to a module that I am missing.
>> >
>> > Thanks!
>> >
>> > Mark
>> >
>> >
>> > On Fri, Jan 31, 2014 at 6:06 PM, Mark Phillips
>> > <mark@phillipsmarketing.biz>
>> > wrote:
>> >>
>> >> 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/CAEqej2MLB-b7_cRZn7pEnCP1bTTm-zWuxyGC%3DK9UcZgMZq1pvw%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>> --
>> 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/CAAuoY6PmcANqfwHVeuQ7WX82%3DkHJyziQsVOpN_Wrcc5hCYj%2BCQ%40mail.gmail.com.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> 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
>To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAuoY6MijaLALdK355OADdYzXcTcJdNNymf%2B-ySUgM3ZOXknDQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
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/CAEqej2Mp-zMFwk7%3DyDX6-0vBcoG%2BJJuKN9o7LUONQcfZqWg2Vg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.