Advertisement
Guest User

Untitled

a guest
Jul 6th, 2017
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. @Component({
  2. selector: 'app-application',
  3. templateUrl: 'app.application.html'
  4. })
  5. export class ApplicationComponent {
  6. public uploader: FileUploader = new FileUploader({
  7. url: MyEndPoint
  8. });
  9.  
  10. @application.post()
  11. def job_application(request):
  12.  
  13. request.response.headerlist.extend(
  14. (
  15. ('Access-Control-Allow-Origin', AngularClient),
  16. ('Content-Type', 'application/json'),
  17. ('Access-Control-Allow-Credentials', 'true'),
  18. ('Allow', 'GET, POST')
  19. )
  20. )
  21.  
  22.  
  23. mailer = Mailer(host="smtp.gmail.com",
  24. port="465", username="makeemup@gmail.com", password="password", ssl=True)
  25. message = Message(subject="It works!",
  26. sender="makeemup@gmail.com",
  27. recipients=["makeemup@gmail.com"],
  28. body="hello"
  29. )
  30.  
  31. if request.POST:
  32.  
  33. attachment = Attachment("photo.doc", "doc/docx", str(request.body))
  34. message.attach(attachment)
  35.  
  36. mailer.send_immediately(message, fail_silently=True)
  37.  
  38. return request.response
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement