Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var express = require('express');
- var router = express.Router();
- const nodemailer = require("nodemailer");
- /* GET home page. */
- router.get('/', function(req, res, next) {
- res.render('index', { title: 'Express' });
- });
- router.get('/askForCookiesRecipe', function(req, res, next) {
- var smtpTransport = nodemailer.createTransport({
- service: "smtp.gmail.com",
- auth: {
- user: "cormoranger@gmail.com",
- pass: "Felixlo1"
- }
- });
- smtpTransport.sendMail({
- from: "Bonaert Felix <bonaert.felix@gmail.com>", // Expediteur
- to: "`supergrandma@yopmail.com", // Destinataires
- subject: "DES COOKIES STP", // Sujet
- text: "Salut mamy fais moi des cookies j'ai faim", // plaintext body
- html: "<b>Salut mamy fais moi des cookies j'ai très faim</b>" // html body
- }, (error, response) => {
- if(error){
- console.log(error);
- }else{
- console.log("Message sent: " + response.message);
- }
- });
- });
- module.exports = router;
Add Comment
Please, Sign In to add comment