Hola, pregunta:
recibo un fichero ya en base64 y lo debo adjuntar en un correo electronico. Leyendo, el set_payload lo codifica con base64. Por tanto, tengo un base64 de base64, y el fichero adjunto, pues esta dañado. como lo haceis? Ahora dispongo de este código, donde * data: recibo el fichero en base 64 * filename: recibo el nombre del fichero data, filename = report[1:3] content_type, _ = mimetypes.guess_type(filename) maintype, subtype = ( content_type or 'application/octet-stream' ).split('/', 1) attachment = MIMEBase(maintype, subtype) attachment.set_payload(data) http://docs.python.org/library/email.mime.html http://docs.python.org/library/email.message.html?highlight=set_payload#email.message.Message.set_payload -- Si us plau, NO adjunti arxius a les seves respostes. Li preguem que integri el text al cos del missatge. Pot respondre usant NetEtiquete que li ajudarà a seguir la conversa. http://es.wikipedia.org/wiki/Netiquette Por favor, NO adjunte archivos a sus respuestas. Le rogamos que integre el texto en el cuerpo del mensaje. Puede responder usando NetEtiquete que le ayudará a seguir la conversación.http://es.wikipedia.org/wiki/Netiquette Please, DO NOT send attachment files with your answers, just copy and paste only the text you need to send into the body of your mails. Repply using NetEtiquete. http://en.wikipedia.org/wiki/Netiquette
_______________________________________________ Python-es mailing list Python-es@python.org http://mail.python.org/mailman/listinfo/python-es FAQ: http://python-es-faq.wikidot.com/