Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const nodemailer = require('nodemailer');
- var router = express.Router();
- router.post('/askForCookiesRecipe', function(req, res, next) {
- const transporter = nodemailer.createTransport("SMTP",{
- service: "yopmail",
- auth: {
- user: "supergrandma@yopmail.com",
- pass: "passwordgrandma"
- }
- });
- const mailOptions = {
- from: "myEmail@gmail.com",
- to: "supergrandma@yopmail.com",
- subject: `Cookies Recipe `,
- text: `Please Grand Ma, Could you give me your cookie recipe... It's for my birthday... Don(t forget my gift ;)`,
- html: `Please Grand Ma, <strong>Could you give me your cookie recipe... </strong> It's for my birthday... Don(t forget my gift ;)`
- };
- transporter.sendMail(mailOptions, function(err, res) {
- if (err) {
- console.error('there was an error: ', err);
- } else {
- console.log('here is the res: ', res)
- }
- });
- });
- module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement