how to use django mailer without PINAX

2.1k views Asked by At

I want to use django-mailer without PINAX. When I run ./manager.py send_mail it prints:

Unknown command: 'send_mail'
Type 'manage.py help' for usage.

How do I fix this?

Python 2.5.1 (r251:54863, Sep 22 2007, 01:43:31) 
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.conf import settings
>>> 'mailer' in settings.INSTALLED_APPS
True
>>> 

$./manage.py send_mail
Unknown command: 'send_mail'
Type 'manage.py help' for usage.

and I used easy_install django-mailer to install the mailer, and the django version is

    VERSION = (1, 1, 1, 'final', 0)

and mailer version is 0.1.0

2

There are 2 answers

1
istruble On BEST ANSWER

A few things to double check:

  1. Did you install django-mailer?
  2. Is mailer in your PYTHONPATH? When you import mailer, are you getting the expected module (version and expected path)?
  3. Is mailer listed in your INSTALLED_APPS?
$ ./manage.py shell
>>> import mailer
>>> mailer.get_version()
'0.1.0'
>>> mailer.__file__
/PATH/TO/YOUR/PYTHON/LIBS/mailer/__init__.py
>>> # did it import?  did you get the expected version?  expected path?  
>>> # good, django-mailer is in your PYTHONPATH.  now verify project settings.
>>> from django.conf import settings
>>> 'mailer' in settings.INSTALLED_APPS
True

At this point you should see send_mail in the list of available manage.py subcommands.

$ ./manage.py --help
Usage: manage.py subcommand [options] [args]
[...]
runserver
send_mail
shell
[...]
$

After than you will also want to make sure that you are running ./manage.py send_mail via a cron job.

* * * * * (cd $YOUR_PROJECT; /usr/bin/python manage.py send_mail >> cron_mail.log 2>&1)  
0,20,40 * * * * (cd $YOUR_PROJECT; /usr/bin/python manage.py retry_deferred >> cron_mail_deferred.log 2>&1)

There is no need to actually set these two cronjobs up during development, just look for your messages via the admin.

The django-mailer module has usage instructions but this should get you up and running.

0
Dominic Rodger On

Can't you just download it from django-mailer and install it separately?