First time here? Check out the FAQ!
3

Askbot not sending email

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?

finid's avatar
123
finid
asked 2012-07-08 05:48:31 -0600, updated 2012-07-08 05:51:41 -0600
edit flag offensive 0 remove flag 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's avatar Evgeny (2012-07-08 11:57:43 -0600) 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's avatar finid (2012-07-08 18:29:10 -0600) 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's avatar Evgeny (2012-07-08 18:40:51 -0600) 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's avatar finid (2012-07-08 19:27:11 -0600) 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's avatar finid (2012-07-08 21:33:21 -0600) edit
add a comment see more comments

5 Answers

0

goto main.py shell using python main.py shellthen use this django code to manually send email to "to@email.com" change with watever you want from django.core.mail import EmailMessage email = EmailMessage('email Testing', 'This is a test for that Strange user',to=['to@email.com']) email.send() if you getting "1" as output then your email is working

you get output "1" and your email not working on askbot then check your time zone that maybe one issue

5p4r70n's avatar
1
5p4r70n
answered 2020-08-18 11:48:01 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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.

dishant's avatar
1
dishant
answered 2013-02-19 11:37:47 -0600
edit flag offensive 0 remove flag delete link

Comments

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

Evgeny's avatar Evgeny (2013-02-19 13:20:34 -0600) 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's avatar dishant (2013-02-19 14:17:34 -0600) 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's avatar Evgeny (2013-02-19 14:51:20 -0600) 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's avatar Evgeny (2013-02-19 14:54:01 -0600) 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's avatar dishant (2013-02-19 16:49:03 -0600) edit
add a comment see more comments
0

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

Thanks,

finid's avatar
123
finid
answered 2012-07-08 22:59:31 -0600
edit flag offensive 0 remove flag delete link

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's avatar Evgeny (2012-07-08 23:03:03 -0600) 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's avatar finid (2012-07-09 02:09:22 -0600) 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's avatar finid (2012-07-10 04:23:56 -0600) edit

Rough estimate when the next release will be?

finid's avatar finid (2012-07-10 07:01:28 -0600) edit

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

powlo's avatar powlo (2012-07-14 13:59:07 -0600) edit
add a comment see more comments
1

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.

Evgeny's avatar
13.2k
Evgeny
answered 2012-07-08 19:41:20 -0600, updated 2012-07-08 19:43:26 -0600
edit flag offensive 0 remove flag delete link

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's avatar mattbenh (2013-11-05 14:48:52 -0600) edit
add a comment see more comments
0

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

powlo's avatar
260
powlo
answered 2012-07-08 10:00:49 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments