Search - User list
Full Version: Can not send mail when register a new user
Root » The Other » Can not send mail when register a new user
1
tianhl
Dear All:

I follow the directions to finish the installion:



I meet the same question just like:


the error is :

ImproperlyConfigured at /forum/account/signup/
Error importing email backend module mailer.backend: “No module named backend”
Request Method: POST
Request URL: http://127.0.0.1:8000/forum/account/signup/
Django Version: 1.4.3
Exception Type: ImproperlyConfigured
Exception Value:
Error importing email backend module mailer.backend: “No module named backend”
Exception Location: /home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/mail/__init__.py in get_connection, line 35
Python Executable: /home/tianhl/workarea/webDev/.env/bin/python
Python Version: 2.7.3

but I have install the django.mailer at /home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/mailer

I wonder why django can not import mailer.backend.DbBackend?

In setting.py,
try:
    import mailer
    INSTALLED_APPS += ('mailer',)
    EMAIL_BACKEND = "mailer.backend.DbBackend"
except ImportError:
    pass

which is followed the direction of


and there is no error reported when django-bb initialize

when I run ./manage.py send_mail

the error is:

(.env)tianhl@tianhl-c105:~/workarea/webDev/slav0nic-djangobb_project-548e4081d215/basic_project$ ./manage.py send_mail
————————————————————————
acquiring lock…
acquired.
(0.001) SELECT COUNT(*) FROM “mailer_message” WHERE “mailer_message”.“priority” = 1 ; args'1',)
releasing lock…
released.
Traceback (most recent call last):
File “./manage.py”, line 10, in <module>
execute_from_command_line(sys.argv)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/management/__init__.py”, line 443, in execute_from_command_line
utility.execute()
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/management/__init__.py”, line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/management/base.py”, line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/management/base.py”, line 232, in execute
output = self.handle(*args, **options)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/management/base.py”, line 371, in handle
return self.handle_noargs(**options)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/mailer/management/commands/send_mail.py”, line 19, in handle_noargs
send_all()
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/mailer/engine.py”, line 63, in send_all
for message in prioritize():
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/mailer/engine.py”, line 26, in prioritize
while Message.objects.high_priority().count() or Message.objects.medium_priority().count():
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/db/models/query.py”, line 351, in count
return self.query.get_count(using=self.db)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/db/models/sql/query.py”, line 418, in get_count
number = obj.get_aggregation(using=using)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/db/models/sql/query.py”, line 384, in get_aggregation
result = query.get_compiler(using).execute_sql(SINGLE)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/db/models/sql/compiler.py”, line 818, in execute_sql
cursor.execute(sql, params)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/db/backends/util.py”, line 40, in execute
return self.cursor.execute(sql, params)
File “/home/tianhl/workarea/webDev/.env/local/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/db/backends/sqlite3/base.py”, line 344, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: no such table: mailer_message



how can I solve this problem?

I am appreciated for your kindly help

Haolai
tianhl
after I run ./manage.py syncdb –all

./manage.py send_mail
gives the message as follow:

————————————————————————
acquiring lock…
acquired.
(0.001) SELECT COUNT(*) FROM “mailer_message” WHERE “mailer_message”.“priority” = 1 ; args'1',)
(0.000) SELECT COUNT(*) FROM “mailer_message” WHERE “mailer_message”.“priority” = 2 ; args'2',)
(0.000) SELECT COUNT(*) FROM “mailer_message” WHERE “mailer_message”.“priority” = 1 ; args'1',)
(0.000) SELECT COUNT(*) FROM “mailer_message” WHERE “mailer_message”.“priority” = 2 ; args'2',)
(0.000) SELECT COUNT(*) FROM “mailer_message” WHERE “mailer_message”.“priority” = 3 ; args'3',)
(0.000) SELECT COUNT(*) FROM “mailer_message” WHERE “mailer_message”.“priority” < 4 ; args'4',)
releasing lock…
released.

0 sent; 0 deferred; 0 don't send
done in 0.01 seconds
slav0nic
u can disable it and use standart django functionality without writing msg to table and senind later
tianhl
slav0nic
u can disable it and use standart django functionality without writing msg to table and senind later

Dear Slav0nic
Thanks a lot, for your application and kindly help also.

I have changed the setting:
try:
    import mailer
    INSTALLED_APPS += ('mailer',)
    #EMAIL_BACKEND = "mailer.backend.DbBackend"
    EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
except ImportError:
    pass

there is nothing wrong, but the register mail has not been send to the mailbox.
I logged in as an administrator, and active the new user by hand.

but how can I use the auto-register-mail function?

Best Regards
Yours Haolai
slav0nic
test sending mail from console and read official django docs about this
./manage.py shell

from django.core.mail import send_mail
send_mail(subject, message, from_email, ['admin@example.com'])


and remove import mailer block for using classic way for sending mail


tianhl
slav0nic
test sending mail from console and read official django docs about this

I have used classical django mailer as described here:
Sending email

Everything is OK, Thanks a lot
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB