Commit 3d5a9743 by Tu Nombre

Copio metodo twilio de codificacion

1 parent 765e8895
...@@ -218,14 +218,17 @@ class Mail(ServiceBase): ...@@ -218,14 +218,17 @@ class Mail(ServiceBase):
if file == 'texto': if file == 'texto':
objeto = open(filepath, "r") objeto = open(filepath, "r")
msg["Body"] = objeto.read() msg["Body"] = objeto.read()
objeto.close()
else: else:
objeto = open(filepath, "rb") with open('attachment.pdf', 'rb') as f:
adj = {"content":str(base64.b64encode(objeto.read())), contenido = f.read()
f.close()
adj = {"content": base64.b64encode(data).decode(),
"filename": file, "filename": file,
"disposition": "attachment", "disposition": "attachment",
"type": "application/pdf"} "type": "application/pdf"}
msg["Adjuntos"].append(adj) msg["Adjuntos"].append(adj)
objeto.close()
return(msg) return(msg)
def ControlMail(self,stadomail,smtp): def ControlMail(self,stadomail,smtp):
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!