From 5bed152a0dc6e0144cee2e8f410aa10533271630 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 1 Mar 2015 11:04:37 -0600 Subject: [PATCH] email cid on GAE --- gluon/packages/dal | 2 +- gluon/tools.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gluon/packages/dal b/gluon/packages/dal index 5cdfd882..2f513d83 160000 --- a/gluon/packages/dal +++ b/gluon/packages/dal @@ -1 +1 @@ -Subproject commit 5cdfd882f578ba970ba8d3d82c02af3906b7e9a4 +Subproject commit 2f513d830cbe3ec1c2b3670bc04de509e52fe21e diff --git a/gluon/tools.py b/gluon/tools.py index 7287b0a4..a6fb3071 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -182,6 +182,10 @@ class Mail(object): Create Mail object with authentication data for remote server:: mail = Mail('example.com:25', 'me@example.com', 'me:password') + + Notice for GAE users: + attachments have an automatic content_id='attachment-i' where i is progressive number + in this way the can be referenced from the HTML as etc. """ class Attachment(MIMEBase.MIMEBase): @@ -772,8 +776,11 @@ class Mail(object): xcc['bcc'] = bcc if reply_to: xcc['reply_to'] = reply_to - from google.appengine.api import mail - attachments = attachments and [(a.my_filename, a.my_payload) for a in attachments if not raw] + from google.appengine.api import mail, Attachment + attachments = attachments and [Attachment(a.my_filename, + a.my_payload, + contebt_id='' % k) + for k,a in enumerate(attachments) if not raw] if attachments: result = mail.send_mail( sender=sender, to=origTo,