Skip to content

Commit

Permalink
Fix sending emails with Amazon SES
Browse files Browse the repository at this point in the history
  • Loading branch information
neokore committed Jun 22, 2015
1 parent 686ff55 commit 7b361d4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/api/authutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ def sendEmail(toAddresses,subject,body):
fromAddr = app.config["smtpFromAddr"]

msg = MIMEMultipart('alternative')
msg['From'] = app.config["smtpFromAddrName"]
msg['To'] = ", ".join(toAddresses)
msg['From'] = '"%s"<%s>' % (app.config["smtpFromAddrName"], app.config["smtpFromAddr"])
msg['To'] = ",".join(toAddresses)
msg['Subject'] = Header(subject,'utf-8')

msg.attach(MIMEText(body.encode("utf-8"), 'html','utf-8'))

text = msg.as_string()

try:
server.sendmail(fromAddr, toAddresses, text)
finally:
Expand All @@ -77,4 +78,4 @@ def getConfirmationEmailBody(user,code,lang="es"):
m += "<h2>"+app.trans['EMAIL_MSG_CONFIRM'][lang]+"</h2>"
m += "<p>" + app.trans['EMAIL_MSG_PRELINK'][lang] + link + app.trans['EMAIL_MSG_POSTLINK'][lang] +"</p>"

return m;
return m;

0 comments on commit 7b361d4

Please sign in to comment.