diff --git a/VERSION b/VERSION index 4dc36d35..680409b5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.16.1-stable+timestamp.2018.02.26.19.05.23 +Version 2.16.1-stable+timestamp.2018.03.08.10.23.01 diff --git a/gluon/tools.py b/gluon/tools.py index c138242d..99519330 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -775,7 +775,9 @@ class Mail(object): if attachments: result = mail.send_mail( sender=sender, to=origTo, - subject=to_unicode(subject, encoding), body=to_unicode(text or '', encoding), html=html, + subject=to_unicode(subject, encoding), + body=to_unicode(text or '', encoding), + html=html, attachments=attachments, **xcc) elif html and (not raw): result = mail.send_mail( @@ -785,6 +787,20 @@ class Mail(object): result = mail.send_mail( sender=sender, to=origTo, subject=to_unicode(subject, encoding), body=to_unicode(text or '', encoding), **xcc) + elif self.settings.server == 'aws': + import boto3 + from botocore.exceptions import ClientError + client = boto3.client('ses') + try: + raw = payload.as_string() + response = client.send_raw_email(RawMessage=raw, + Source=sender, + Destinations=to) + return True + except ClientError as e: + # we should log this error: + # print e.response['Error']['Message'] + return False else: smtp_args = self.settings.server.split(':') kwargs = dict(timeout=self.settings.timeout)