Skip to content
Snippets Groups Projects
Commit 3678d41d authored by Julian's avatar Julian
Browse files

Support SMTP without authentication

Closes #150
parent 8a6ca93c
Branches
Tags
No related merge requests found
...@@ -31,7 +31,7 @@ ACL_SIGNUP_GROUP="uffd_signup" ...@@ -31,7 +31,7 @@ ACL_SIGNUP_GROUP="uffd_signup"
MAIL_SERVER='' # e.g. example.com MAIL_SERVER='' # e.g. example.com
MAIL_PORT=465 MAIL_PORT=465
MAIL_USERNAME='yourId@example.com' MAIL_USERNAME='yourId@example.com' # set to empty string to disable authentication
MAIL_PASSWORD='*****' MAIL_PASSWORD='*****'
MAIL_USE_STARTTLS=True MAIL_USE_STARTTLS=True
MAIL_FROM_ADDRESS='foo@bar.com' MAIL_FROM_ADDRESS='foo@bar.com'
......
...@@ -24,6 +24,7 @@ def sendmail(addr, subject, template_name, **kwargs): ...@@ -24,6 +24,7 @@ def sendmail(addr, subject, template_name, **kwargs):
server = smtplib.SMTP(host=current_app.config['MAIL_SERVER'], port=current_app.config['MAIL_PORT']) server = smtplib.SMTP(host=current_app.config['MAIL_SERVER'], port=current_app.config['MAIL_PORT'])
if current_app.config['MAIL_USE_STARTTLS']: if current_app.config['MAIL_USE_STARTTLS']:
server.starttls() server.starttls()
if current_app.config['MAIL_USERNAME']:
server.login(current_app.config['MAIL_USERNAME'], current_app.config['MAIL_PASSWORD']) server.login(current_app.config['MAIL_USERNAME'], current_app.config['MAIL_PASSWORD'])
server.send_message(msg) server.send_message(msg)
server.quit() server.quit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment