I have some code to parse an email and find the attachments then store them into the Datastore as db.BlobProperties (might change that to Blobstore later). The problem is t
Check if this code helps:
===========================
my_file = []
my_list = []
if hasattr(mail_message, 'attachments'):
file_name = ""
for filename, filecontents in mail_message.attachments:
file_name = filename
file_blob = filecontents.payload
file_blob = file_blob.decode(filecontents.encoding)
my_file.append(file_name)
my_list.append(str(store_file(self, file_name, file_blob)))