larrabee / freeipa-password-reset

Self-service password reset app for FreeIPA
GNU General Public License v3.0
88 stars 30 forks source link

Mail error #49

Closed pqvindesland closed 3 years ago

pqvindesland commented 3 years ago

Hi

I hope that you can help me.

I am using Centos 8, I got no errors during the installation I would like to use email to send out the token to the users but it's failing with error "Cannot send Email" after typing in a username and pressing "Reset Password".

I have checked the logs but it's not adding anything to the logs, do you have any suggestions to where i can start looking, the email configuration is below.

Regards Per

"email-1": {
    "class": app.providers.Email,
    "enabled": True,
    "display_name": "Email",
    "options": {
        # In template {0} will replaced with token
        "msg_template": "Your reset password token: {0} \nDo not tell anyone this code.",
        "msg_subject": "Your LDAP password reset code",
        "smtp_from": None, #With None its copy value from smtp_user
        "smtp_user": "",
        "smtp_pass": "",
        "smtp_server_addr": "mail-server-ip",
        "smtp_server_port": 25,
        "smtp_server_tls": False,
larrabee commented 3 years ago

Hello. I added the error output to the master branch.

pqvindesland commented 3 years ago

Thanks I am not sure what you did but I got a bit further now

With the same settings I now get the error: Cannot send Email, error: SMTP AUTH extension not supported by server. which makes sense the mail server doesn't need authentication, but how can I tell the configuration that it doesn't need to auth to the mail server? I tried setting "smtp_from": None, to "smtp_from": emailaddress@company.com, but it seems to expect the None and refused to start.

Do you have any idea?

larrabee commented 3 years ago

If your mail server does not support auth you should set:

"smtp_user": None,
"smtp_pass": None,
pqvindesland commented 3 years ago

Thanks that removed that error but it's now giving error Cannot send Email, error: 'NoneType' object has no attribute 'strip'

The congfiguration is as below: }, "email-1": { "class": app.providers.Email, "enabled": True, "display_name": "Email", "options": {

In template {0} will replaced with token

        "msg_template": "Your reset password token: {0} \nDo not tell anyone this code.",
        "msg_subject": "Your LDAP password reset code",
        "smtp_from": None, #With None its copy value from smtp_user
        "smtp_user": None,
        "smtp_pass": None,
        "smtp_server_addr": "127.0.0.1",
        "smtp_server_port": 25,
        "smtp_server_tls": True,
    },
},
larrabee commented 3 years ago

Are you sure that your server use TLS? I think smtp_server_tls should be False And you should set smtp_from to valid email address.

pqvindesland commented 3 years ago

I tried setting "smtp_server_tls": True, to "smtp_server_tls": False, and smtp_from from None to a email address but when I restart ldap-passwd-reset it doesn't start again.

If I run /opt/data/IPAPasswordReset/virtualenv/bin/python /opt/data/IPAPasswordReset/PasswordReset/manage.py then it says:

File "/opt/data/IPAPasswordReset/PasswordReset/PasswordReset/settings.py", line 166, in "smtp_from": perqvindesland@company.com, #With None its copy value from smtp_user NameError: name 'perqvindesland' is not defined

pqvindesland commented 3 years ago

I sorted it out I forgot to put the email address between "perqvindesland@company.com"

Email works now :)

Many thanks for your help