diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-06-17 22:58:58 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-06-17 22:58:58 +0200 |
commit | adfef259c9af085bc5ef9e5aae32bf00ab2fce38 (patch) | |
tree | 7e60e06dc125c84c975762e166d94f4854adff49 /src/notifications/emails.py | |
parent | The Postmark team has chosen not to continue development of the Heroku Add-on... (diff) | |
download | newspipe-adfef259c9af085bc5ef9e5aae32bf00ab2fce38.tar.gz newspipe-adfef259c9af085bc5ef9e5aae32bf00ab2fce38.tar.bz2 newspipe-adfef259c9af085bc5ef9e5aae32bf00ab2fce38.zip |
Closes #33.
Diffstat (limited to 'src/notifications/emails.py')
-rw-r--r-- | src/notifications/emails.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/notifications/emails.py b/src/notifications/emails.py index ebf301ef..0ae6519a 100644 --- a/src/notifications/emails.py +++ b/src/notifications/emails.py @@ -89,7 +89,7 @@ def send_postmark(to="", bcc="", subject="", plaintext=""): """ Send an email via Postmark. Used when the application is deployed on Heroku. - Note: The Postmark team has chosen not to continue development of this + Note: The Postmark team has chosen not to continue development of the Heroku add-on as of June 30, 2017. Newspipe is now using SendGrid when deployed on Heroku. """ @@ -114,15 +114,18 @@ def send_sendgrid(to="", bcc="", subject="", plaintext=""): Heroku. """ sg = sendgrid.SendGridAPIClient(apikey=conf.SENDGRID_API_KEY) - from_email = Email(conf.NOTIFICATION_EMAIL) - subject = subject - to_email = Email(to) - content = Content('text/plain', plaintext) - mail = Mail(from_email, subject, to_email, content) + + mail = Mail() + mail.from_email = Email('info@newspipe.org') + mail.subject = subject + mail.add_content(Content('text/plain', plaintext)) + + personalization = Personalization() + personalization.add_to(Email(to)) if bcc != "": - personalization = Personalization() personalization.add_bcc(Email(bcc)) - mail.add_personalization(personalization) + mail.add_personalization(personalization) + response = sg.client.mail.send.post(request_body=mail.get()) # print(response.status_code) # print(response.body) |