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");
- var smtpTransport = nodemailer.createTransport({
- host: 'smtp.gmail.com',
- port: 587,
- secure: false,
- auth: {
- user: "projetpfb@gmail.com",
- pass: "jecode4wcs"
- }
- });
- // Création de la méthode de transport de l'email
- /* GET users listing. */
- router.get('/', function (req, res, next) {
- res.send('Hey ! It\'s a GET');
- });
- router.get('/askForCookiesRecipe', function(req, res, next){
- smtpTransport.sendMail({
- from: "Deer Wild <projetpfb@gmail.com>", // Expediteur
- to: "supergrandma@yopmail.com", // Destinataires
- subject: "Coucou grand-mère!", // Sujet
- text: "Hello Grand-mère ✔", // plaintext body
- html: "<b>J'aurais besoin de ta recette de cookies. Tu peux me la partager s'il te plaît ? Merci et Gros bisous grand-mère!</b>" // html body
- }, (error, response) => {
- if (error) {
- console.log(error);
- } else {
- console.log("Message sent: ", response.response);
- }
- });
- })
- module.exports = router;
Add Comment
Please, Sign In to add comment