Guest User

Untitled

a guest
Jan 3rd, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. const nodemailer = require("nodemailer");
  2. require('dotenv').config()
  3. const password = process.env.GMAIL_PASS;
  4.  
  5.  
  6. // Création de la méthode de transport de l'email
  7. var smtpTransport = nodemailer.createTransport({
  8. service: "Gmail",
  9. auth: {
  10. user: "elucchini17@gmail.com",
  11. pass: password
  12. }
  13. });
  14.  
  15. router.get('/askforcookiesrecipe', function(req, res, next) {
  16. smtpTransport.sendMail({
  17. from: "Petit Chaperon Rouge <elucchini17@gmail.com>", // Expediteur
  18. to: "supergrandma@yopmail.com", // Destinataires
  19. subject: "Cookies recipe", // Sujet
  20. text: "Aboule la recette d cookies steup ✔", // plaintext body
  21. html: "<b>Aboule la recette d cookies steup ✔</b>" // html body
  22. }, (error, response) => {
  23. if(error){
  24. console.log(error);
  25. }else{
  26. console.log("Message sent: ", response);
  27. }
  28. });
  29. });
  30.  
  31.  
  32. module.exports = router;
Add Comment
Please, Sign In to add comment