OK, I did it by writing in temp files. If anyone is interested, here's
the code:
atts=[]
for attachment in attachments:
path=os.path.join(request.folder,"uploads/
tmp/",str(attachment.id)+"-"+attachment.name)
output_file=open(path, "wb")
output_file.write(attachment.data)
output_file.close()
atts.append(Mail.Attachment(path))
os.remove(path)
mail.send(to = request.vars.receiver,
subject = request.vars.subject,
message = (None,message),
attachments=atts)
It will be nice if Mail.Attachment can attach files right from blob
fields
On 19 Апр, 15:42, Bob <[email protected]> wrote:
> Can Mail.Attachment work with blob field data instead of a file path?
> I guess I can just write the file and give the path then but wondered
> if there is more elegant solution like passing the blob data directly
> to Mail
>
> Thanks