Smtp does not work I get Server error

Hello everyone I tried to set up the smtp ( gmail or hotmail ) service but it does not work
when I click reset my password button It waits and after a while I get the server error

here are my configuration

in cms/envs/common.py
and lms/envs/common.py

I have

EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’

EMAIL_HOST = ‘smtp-mail.outlook.com

EMAIL_PORT = 587

EMAIL_USE_TLS = True

EMAIL_HOST_USER = ‘myemail’

EMAIL_HOST_PASSWORD = ‘my pass’

DEFAULT_FROM_EMAIL = ‘myemail’

SERVER_EMAIL = ‘my email’

and in

lms/envs/aws.py

EMAIL_HOST = ENV_TOKENS.get(‘EMAIL_HOST’, ‘smtp-mail.outlook.com’)

EMAIL_PORT = ENV_TOKENS.get(‘EMAIL_PORT’, 587)

EMAIL_USE_TLS = ENV_TOKENS.get(‘EMAIL_USE_TLS’, True) # django default is False

EMAIL_HOST_USER = AUTH_TOKENS.get(‘EMAIL_HOST_USER’, myemail’)

EMAIL_HOST_PASSWORD = AUTH_TOKENS.get(‘EMAIL_HOST_PASSWORD’, 'mypass)

and same thing with the json and yml files

and I tried with gmail , same result , it did not work

Any Idea?

Thanks

Hi @tom

I’running on mine on azure but if that helps you take a look the next steps that I followed:

IMPORTANT: Before editing the files, please create a copy of the originals as backup, ie:

 sudo cp file.ext cp file.ext.old

And please mind the quotes if the original file has it. Only in lms.yml I found that some of them has '' (two single quotes), so that means empty and you can input the right data without the quotes.

1. There is one small but important change that you’ll need to make to your default Gmail account settings in order for Gmail to allow Open edX to connect. After logging in to your Gmail account from a web browser, navigate to https://myaccount.google.com/lesssecureapps to change the setting for “Allow less secure apps” to “On”. Source

2.a. Edit lms.auth.json and cms.auth.json in /edx/app/edxapp/ as follows:

"EMAIL_HOST_PASSWORD": "password",
"EMAIL_HOST_USER": "name@domain.com",

2.b. Edit lms.env.json and cms.env.json in /edx/app/edxapp/ as follows:

"EMAIL_BACKEND": "django.core.mail.backends.smtp.EmailBackend",
"EMAIL_HOST": "smtp.gmail.com",
"EMAIL_PORT": 587,
"EMAIL_USE_TLS": true,

Source here.

3. Edit the following in /edx/etc/lms.yml

EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST: smtp.gmail.com
EMAIL_HOST_PASSWORD: password
EMAIL_HOST_USER: name@domain.com
EMAIL_PORT: 587
EMAIL_USE_TLS: true

Source here.

4. Restart lms, cms and edxapp_worker

/edx/bin/supervisorctl restart lms cms edxapp_worker:

  1. You can check the logs in /edx/var/log/lms/edx.log to get more information on that.

I wish yo can find a solution.

Cheers,

Hi,

In gmail you need change some options.

Hello , thanks I know that I have changed that , but it still does not work

Hello Thanks , I have done that before but it still does not work

when I click reset password the server stop and then I get server error message ,

can you share your log in pastebin?

For me, after turn on “less secure app”. (this is described in the lms log,Check Gmail through other email platforms - Gmail Help) I still need to Sign in - Google Accounts , there it asks
Allow access to your Google account
As a security precaution, Google may require you to complete this additional step when signing into a new device or application.
To allow access, click the Continue button below.
After click Continue, now it works.
I am using lilac.2 Native.