Ask Your Question
3

Askbot not sending email

asked 2012-07-08 05:48:31 -0500

finid gravatar image

updated 2012-07-08 05:51:41 -0500

Just installed Askbot, but when new user register, email are not been sent for validation. The outgoing mail config section in settings.py are shown below:

#outgoing mail server settings
SERVER_EMAIL = 'smtp.webfaction.com'
DEFAULT_FROM_EMAIL = 'xyz@linuxbsdos.com.com'
EMAIL_HOST_USER = 'cmail'
EMAIL_HOST_PASSWORD = 'xtvwedcv'
EMAIL_SUBJECT_PREFIX = 'Automated Message from LinuxBSDos.com'
EMAIL_HOST='smtp.webfaction.com'
EMAIL_PORT='587'
EMAIL_USE_TLS=True # was False
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

What else do I need to set to get it to send email on user registration?

Suggestion:

How about a test email send feature from the UI, as it is on OSQA?

edit retag flag offensive close merge delete

Comments

The SERVER_EMAIL setting is incorrect - an email address is expected there, maybe that's the issue. Also maybe you don't have mailbox set up at webfaction or credentials are invalid. The UI for email testing is a good idea.

Evgeny gravatar imageEvgeny ( 2012-07-08 11:57:43 -0500 )edit

But if an email is expected at SERVER_EMAIL, will that be the same as the value of DEFAULT_FROM_EMAIL ? Btw, there is a mailbox set up and the email credentials are correct. In any case, I'll test it with the value of SERVER_EMAIL set to the same as DEFAULT_FROM_EMAIL and see if it works. And thanks for replying.

finid gravatar imagefinid ( 2012-07-08 18:29:10 -0500 )edit

It can be any valid email address, does not matter which exactly, but better match the domain name to the mail server domain, otherwise your messages can be filtered out as spam.

Evgeny gravatar imageEvgeny ( 2012-07-08 18:40:51 -0500 )edit

I just set both email address the same, and, yes, they match the mail servers domain name. Still does not work. Just to be sure, EMAIL_HOST_USER is the name of the mailbox, right?

finid gravatar imagefinid ( 2012-07-08 19:27:11 -0500 )edit

When I type "python manage.py", I get this output: "Traceback (most recent call last): File "manage.py", line 2, in <module> from django.core.management import execute_manager ImportError: No module named django.core.management." I'm new to django, so not sure what to do here.

finid gravatar imagefinid ( 2012-07-08 21:33:21 -0500 )edit

4 Answers

Sort by ยป oldest newest most voted
1

answered 2012-07-08 19:41:20 -0500

Evgeny gravatar image

updated 2012-07-08 19:43:26 -0500

Sorry that there is no better way to test email settings now, but you might do this: on the command line type python manage.py shell from the same directory where your settings.py file is located. Then type:

from django.core.mail import mail_admins
mail_admins('subject line', 'message text')

Then you should get an exception, which might give you some idea of what is not right. You could also consult Webfaction documentation about setting up email with django projects. There is nothing special about askbot in that respect.

Errors are also logged in log/askbot.log within your project directory if you are using default logging configuration.

The UI for testing email configuration is a very good idea.

One place to test email in askbot is the feedback form, but it will not show you actual errors.

edit flag offensive delete link more

Comments

I got my configuration in settings.py set up that our code from django.core.mail import mail_admins mail_admins('subject line', 'message text') will send me (admin) an email. I restarted apache, but the site still does not send emails and there is nothing in my `log/askbot.log` file? Any other suggestions or ideas?

mattbenh gravatar imagemattbenh ( 2013-11-05 14:48:52 -0500 )edit
0

answered 2012-07-08 10:00:49 -0500

powlo gravatar image

You could test the send mail by changing the EMAIL_BACKEND to a file, or console.

See here: https://docs.djangoproject.com/en/dev/topics/email/#email-backends

edit flag offensive delete link more
0

answered 2012-07-08 22:59:31 -0500

finid gravatar image

Just uploading the file. Had to save it in pdf for upload.C:\fakepath\Finidaskbot.pdf

Thanks,

edit flag offensive delete link more

Comments

Ok, clear now. Sorry about this, but there was an issue in the code that you are using. Please remove LocaleMiddleware from your settings.py file. This will be fixed in the next release. The error is in the settings.py template.

Evgeny gravatar imageEvgeny ( 2012-07-08 23:03:03 -0500 )edit

LocaleMiddleware has already been commented out before I posted this question. See the full Middleware Classes section of settings.py. MIDDLEWARE_CLASSES = ( #'django.middleware.gzip.GZipMiddleware', #'askbot.middleware.locale.LocaleMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', #'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', #'django.middleware.cache.FetchFromCacheMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', #'django.middleware.sqlprint.SqlPrintingMiddleware

finid gravatar imagefinid ( 2012-07-09 02:09:22 -0500 )edit

Evgeny, my installation of Askbot and this support forum are using the same code (version 0.7.43). Does this support forum send validation emails? Don't remember receiving one when I registered.

finid gravatar imagefinid ( 2012-07-10 04:23:56 -0500 )edit

Rough estimate when the next release will be?

finid gravatar imagefinid ( 2012-07-10 07:01:28 -0500 )edit

Strange that removing the middleware didn't fix it. You can always try giving ASKBOT_LANGUAGE a value.

powlo gravatar imagepowlo ( 2012-07-14 13:59:07 -0500 )edit
0

answered 2013-02-19 11:37:47 -0500

I'm running into a similar problem. Using version 0.7.48.

I getting the following error message in the logs whenever askbot is trying to send an email:

[Tue Feb 19 17:16:33 2013] [error] timed out

My settings:

SERVER_EMAIL = 'dishantlangayan@gmail.com' DEFAULT_FROM_EMAIL = 'dishantlangayan@gmail.com' EMAIL_HOST_USER = 'dishantlangayan@gmail.com' EMAIL_HOST_PASSWORD = 'mypassword' EMAIL_SUBJECT_PREFIX = 'Askbot: ' EMAIL_HOST='smtp.gmail.com' EMAIL_PORT='465' EMAIL_USE_TLS=True EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

NOTE: if there is an exception raised for example an "Internal Server Error", then askbot sends me an email to the address configured in the ADMINS property in the settings.py.

But if I for example try to recover my password then no emails are sent and I get the timeout error message in the logs.

Also, I have confirmed that using a Console or Filebased EMAIL_BACKEND works fine. Only problem is with smtp.

edit flag offensive delete link more

Comments

This looks like a timeout error on the google part or the network. Try setting up a local mail server.

Evgeny gravatar imageEvgeny ( 2013-02-19 13:20:34 -0500 )edit

Evgeny, I did setup a local mail server using "python -m smtpd -n -c DebuggingServer localhost:1025", that works. If this is a timeout issue, then askbot should not be sending me error emails, such as Internal Server Error with a stack trace. The fact the it is sending emails on exception only is strange. I do have another web app on the same machine, which can successfully send email using the same gmail account, so it does not seem to be a network issue either.

dishant gravatar imagedishant ( 2013-02-19 14:17:34 -0500 )edit

Dishant, you're right - we should be catching the exception. Do you have python stacktrace? We should be able to add an additional "except" statement to capture that error.

Evgeny gravatar imageEvgeny ( 2013-02-19 14:51:20 -0500 )edit

Actually - that timeout error is probably coming from some other place - e.g. a webserver timeout. I don't think it is an smtp error. Not sure what to advise here except not using remote mail server due to the obvious limitations.

Evgeny gravatar imageEvgeny ( 2013-02-19 14:54:01 -0500 )edit

I have it working now. All I did was set the EMAIL_HOST_PASSWORD to empty string in the setting.py file. This is strange because I can use anybody's email now! Anyways, thanks for the help.

dishant gravatar imagedishant ( 2013-02-19 16:49:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-07-08 05:48:31 -0500

Seen: 10,320 times

Last updated: Feb 19 '13