Created
June 23, 2013 07:19
-
-
Save Verurteilt/5844140 to your computer and use it in GitHub Desktop.
DOCX email class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def docx(request): | |
| response = HttpResponse(content_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document") | |
| response['Content-Disposition'] = 'attachment; filename="archivo.docx"' | |
| html_content = "Informacion recibida de <br><br><br>***Mensaje****<br><br>" | |
| msg = EmailMessage('Correo de Contacto', html_content, '[email protected]', [to_admin]) | |
| file_ = open('archivo.docx', 'r+') | |
| msg.attach('archivo.docx', file_.read(), 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') | |
| msg.send() | |
| return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment