Narendra123

upload file email send using html&js

Jun 8th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <form action="https://examples.webscript.io/attachments/file"
  2. method="post" enctype="multipart/form-data">
  3. <input type="text" name="email" value="bnarendra6036@gmail.com" style="display:none;"/>
  4.  
  5. <input type="file" name="attachment" id="resume" accept="application/pdf, application/.doc, application/txt,application/msword" />
  6. <button type="submit">Upload</button>
  7. </form>
  8.  
  9. <script type="text/javascript">
  10. local SERVER = '<SMTP SERVER>'
  11. local USERNAME = '<SMTP USERNAME>'
  12. local PASSWORD = '<SMTP PASSWORD>'
  13.  
  14. email.send {
  15. server=SERVER, username=USERNAME, password=PASSWORD,
  16. from='hello@webscript.io',
  17. to=bnarendra6036@gmail.com,
  18. subject='request.form.role',
  19. text='request.form.role',
  20. attachments = { request.files.attachment }
  21. }
  22. return "Email sent."
  23. </script>
Add Comment
Please, Sign In to add comment