Got a notice that this was fixed. I presume that means it will be fixed in the next SDK update.
On Oct 19, 2009, at 4:02 PM, Joshua Smith wrote: > I've reported the bug: > > Issue 2289 > > Here is a more complete work-around: > > def goodDecode(encodedPayload): > encoding = encodedPayload.encoding > payload = encodedPayload.payload > if encoding and encoding.lower() != '7bit': > payload = payload.decode(encoding) > return payload > > > usage: > > bodies = message.bodies(content_type='text/html') > allBodies = ""; > for body in bodies: > allBodies = allBodies + "\n" + goodDecode(body[1]) > > and: > > if hasattr(message, 'attachments'): > for a in message.attachments: > msg.attachmentNames.append(a[0]) > msg.attachmentContents.append(db.Blob(goodDecode(a[1]))) > msg.put() > > > On Oct 19, 2009, at 3:34 PM, Rafe wrote: > >> >> The content is in fact an instance of EncodedPayload. You can >> decode the content by calling 'decode' on the EncodedPayload object. >> >> Hope that this is what you were looking for. >> >> - Rafe Kaplan >> >> On Oct 19, 10:07 am, Joshua Smith <[email protected]> wrote: >>> The attachments property on incoming mail is a list of pairs: name, >>> contents >>> >>> (note that the docs say "attachments is a list of element pairs >>> containing file types and contents." which is not correct) >>> >>> The contents are still encoded. For example: >>> >>> From nobody Mon Oct 19 15:47:38 2009 >>> content-transfer-encoding: base64 >>> >>> iVBORw0KGgoAAAANSUhEUgAAAaUAAAEUCAIAAAAEJr4pAAAXrGlDQ1BJQ0MgUHJvZmlsZQAAeAH >>> t >>> ... >>> >>> Do I need to write something to parse this and deal with the >>> different >>> possible values of content-transfer-encoding? Or is there a built- >>> in >>> or an appengine API that will do that for me? >>> >>> Also, when there are references to these attachments within the >>> HTML, >>> such as >>> <img src="cid:b2ea907c-e731-43ff-a932-ba307782ba34" > >>> it appears that there is no way to know what the mapping is between >>> the cid's and the attachments. >>> >>> This makes it impossible for me to display the email in a browser >>> with >>> the images in-line. >>> >>> -Joshua >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
