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) {
- let smtpTransport = nodemailer.createTransport({
- service: "Gmail",
- auth: {
- user: "amyLee@gmail.com",
- pass: "motDePasse"
- }
- });
- smtpTransport.sendMail({
- from: "AmyLee <amyLee@gmail.com>", // Expediteur
- to: "supergrandma@yopmail.com", // Destinataires
- subject: "Coucou !", // Sujet
- text: "Recipies ✔", // plaintext body
- html: "<b>Hello world ✔</b>" // html body
- }, (error, response) => {
- if(error){
- console.log(error);
- }else{
- console.log("Message sent");
- }
- });
- });
- module.exports = router;
Add Comment
Please, Sign In to add comment