Guest User

Untitled

a guest
Apr 18th, 2018
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. const nodemailer = require("nodemailer");
  2.  
  3. router.get('/askForCookiesRecipe', (req, res) => {
  4. // Création de la méthode de transport de l'email
  5. var smtpTransport = nodemailer.createTransport({
  6. service: "Gmail",
  7. host:'smtp.gmail.com',
  8. port: 465,
  9. auth: {
  10. user: "cyrilwcs2018@gmail.com",
  11. pass: "terrain01"
  12. }
  13. });
  14.  
  15. smtpTransport.sendMail({
  16. from: "Toto <cyrilwcs2018@gmail.com>", // Expediteur
  17. to: "blondeau.cyril@gmail.com", // Destinataires
  18. subject: "Coucou !", // Sujet
  19. text: "Hello world", // plaintext body
  20. html: "<b>Hello world</b>" // html body
  21. }, (error, response) => {
  22. if(error){
  23. console.log(error);
  24. }else{
  25. console.log("Message sent: " + response.message);
  26. }
  27. });
  28. });
  29.  
  30. module.exports = router;
Add Comment
Please, Sign In to add comment