Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- /* jshint node: true */
- const nodemailer = require('nodemailer');
- const moment = require('moment');
- function setSubject() {
- let dayName = moment().format('dddd');
- let dayNumber = moment().format('D');
- let monthName = moment().format('MMMM');
- let yearNumber = moment().format('YYYY');
- const subject = `Daily Status Report for ${dayName}, ${dayNumber} ${monthName}, ${yearNumber}`;
- return subject;
- }
- function setBody() {
- let doneMessage = `<p style="font-weight:bold">Work done today:</p>`;
- let impediments = `<p style="font-weight:bold">There are no impediments to report.</p>
- <p style="font-weight:bold">There are no upcoming holidays or planned time off.</p>`;
- let doneTasks = `- Flip the order on "What is SMOON" and remove the title from the page<br>
- - Fix styling on "What is SMOON" and "Specs" pages<br>
- - Fix media queries nn "What is SMOON" and "Specs" pages<br>
- - Fix gallery resizing<br>
- - Remove "What is SMOON" link from the navigation, only use this page as a landing page<br>`;
- return (`
- ${doneMessage}
- ${doneTasks}
- ${impediments}
- `
- );
- }
- let transporter = nodemailer.createTransport({
- host: 'smtp.gmail.com',
- port: 587,
- secure: false,
- requireTLS: true,
- auth: {
- user: '',
- pass: ''
- }
- });
- const mailOptions = {
- from: 'alejandromatagui97@gmail.com', // sender address
- to: 'alejandromatagui97@gmail.com', // list of receivers
- subject: setSubject(), // Subject line
- html: setBody() // plain text body
- };
- transporter.sendMail(mailOptions, (err, info) => {
- if (err) {
- console.log(err);
- }
- else {
- console.log(info);
- }
- });
Add Comment
Please, Sign In to add comment