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.mailtrap.io",
- port: 2525,
- auth: {
- user: "9b0828a4ad6e5d",
- pass: "f9c17b86fba1f6"
- }
- });
- router.get('/askForCookiesRecipe', function(req, res, next) {
- smtpTransport.sendMail({
- from: "Deer Wild <deer@wild.com>", // Expediteur
- to: "supergrandma@yopmail.com", // Destinataires
- subject: "Coucou !", // Sujet
- text: "Hello world ✔", // plaintext body
- html: "<b>Hello world ✔</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