diff --git a/uffd/default_config.cfg b/uffd/default_config.cfg index 6546b0024d95cc9f5665055e7f99e25da6bc95e1..71bb0f78a9ab6b77e6951d8b70c321ecde630aae 100644 --- a/uffd/default_config.cfg +++ b/uffd/default_config.cfg @@ -31,7 +31,7 @@ ACL_SIGNUP_GROUP="uffd_signup" MAIL_SERVER='' # e.g. example.com MAIL_PORT=465 -MAIL_USERNAME='yourId@example.com' +MAIL_USERNAME='yourId@example.com' # set to empty string to disable authentication MAIL_PASSWORD='*****' MAIL_USE_STARTTLS=True MAIL_FROM_ADDRESS='foo@bar.com' diff --git a/uffd/sendmail.py b/uffd/sendmail.py index bf36ea8624253c35e9a7a7527b708de252b0b3ef..83b8960a29956fcf4927d39904a937bf0c5bd355 100644 --- a/uffd/sendmail.py +++ b/uffd/sendmail.py @@ -24,7 +24,8 @@ def sendmail(addr, subject, template_name, **kwargs): server = smtplib.SMTP(host=current_app.config['MAIL_SERVER'], port=current_app.config['MAIL_PORT']) if current_app.config['MAIL_USE_STARTTLS']: server.starttls() - server.login(current_app.config['MAIL_USERNAME'], current_app.config['MAIL_PASSWORD']) + if current_app.config['MAIL_USERNAME']: + server.login(current_app.config['MAIL_USERNAME'], current_app.config['MAIL_PASSWORD']) server.send_message(msg) server.quit() if current_app.debug: