SHARE
TWEET

Untitled

a guest Apr 20th, 2018 362 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const nodemailer = require("nodemailer");
  2.  
  3. // Création de la méthode de transport de l'email
  4. router.get('/askForCookiesRecipe', (req, res) => {
  5.     let transporter = nodemailer.createTransport({
  6.         service: "Gmail",
  7.         host: 'smtp.gmail.com',
  8.         auth: {
  9.             user: "rado1811@gmail.com",
  10.             pass: "XXXXXXXXXXXXX"
  11.         },
  12.         tls: {
  13.           rejectUnauthorized: false
  14.       }
  15.     });
  16.  
  17.     let mailOptions = {
  18.         from: "rado1811@gmail.com>", // Expediteur
  19.         to: "supergrandma@yopmail.com, rado1811@gmail.com", // Destinataires
  20.         subject: "Coucou !", // Sujet
  21.         text: "I wanna eat cookies!", // plaintext body
  22.         html: "<b>I wanna eat cookies!</b>" // html body
  23.     };
  24.    
  25. transporter.sendMail(mailOptions, (error, response) => {
  26.     if(error){
  27.         console.log(error);
  28.     }else{
  29.         console.log("Message sent: " + response.message);
  30.     }
  31. });
  32. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top