Last active
April 10, 2021 16:24
-
-
Save yasinkacmaz/992a1ae9bfb454edd6a99b1f6eff0977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = ({ }) => { | |
const execSync = require('child_process').execSync | |
execSync(`npm install nodemailer`) // Install nodemailer | |
const nodemailer = require('nodemailer') | |
const transporter = nodemailer.createTransport({ | |
host: "smtp.live.com", // Host for hotmail | |
port: 587, | |
secureConnection: false, | |
auth: { | |
user: `${process.env.MAIL_USERNAME}`, // I am using hotmail. You can use gmail, yandex etc. | |
pass: `${process.env.MAIL_PASSWORD}` // You can use token too. I use mail and password | |
}, | |
tls: { | |
ciphers: 'SSLv3' | |
} | |
}); | |
const report = require('fs').readFileSync('build/dependencyUpdates/dependency_update_report.txt', 'utf8') | |
const mailOptions = { | |
from: { | |
name: 'Jetflix', | |
address: process.env.MAIL_USERNAME | |
}, | |
to: 'your_desired_mail@gmail.com', // Use your main account to get the email | |
subject: 'Dependency update report of Jetflix ¯\\_(ツ)_/¯', | |
text: `${report}` | |
}; | |
transporter.sendMail(mailOptions, (error, info) => { | |
if (error) { | |
console.log(error) | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment