Skip to content

Instantly share code, notes, and snippets.

@Verurteilt
Created May 24, 2013 05:11
Show Gist options
  • Save Verurteilt/5641383 to your computer and use it in GitHub Desktop.
Save Verurteilt/5641383 to your computer and use it in GitHub Desktop.
def pdf(request):
response = HttpResponse(content_type="application/pdf")
response['Content-Disposition'] = 'attachment; filename="UTEL_Tramites.pdf"'
file_ = GenerarPDF(response=response, user=User.objects.get(id=1))
to_admin = 'mini.guero@hotmail.com'
html_content = "Informacion recibida de <br><br><br>***Mensaje****<br><br>"
msg = EmailMessage('Correo de Contacto', html_content, 'from@server.com', [to_admin])
msg.attach('UTEL_Tramites.pdf', response.content, 'application/pdf')
msg.send()
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment