Hi Alan, Thank you very much. Now it work for me: attach_send = Mail.Attachment(file) tmp = attach_send['Content-Type'].split(';') mime = tmp[0] if len(tmp)>0 else 'text/plain' payload = attach_send.get_payload() attach_sent = dict(filename=attach_send.my_filename,mime=mime,payload=payload,* encoding="base64"*))
Vào 03:14:37 UTC+7 Chủ nhật, ngày 13 tháng mười năm 2013, Alan Etkin đã viết: > > OK, I have uploaded my code: >> https://code.google.com/p/web2py/issues/detail?id=1707 >> > > When you add the binary file data as read from the stream to the > attachment payload without base64 encoding, you'll get the EOF imaplib > error. > > I'll upadate the web2pyslices recipe to do the payload encoding before > calling insert (my bad). Note that the current imapadapter will not add the > transfer encoding to the part header when setting "base64" encoding or > alike (it will only set the part charset), and will probably raise issues > on retrieval, so it should be fixed also (google issue 1714). > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.