-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdependency-update-report-mail-sender.js
More file actions
44 lines (42 loc) · 1.38 KB
/
dependency-update-report-mail-sender.js
File metadata and controls
44 lines (42 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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}`,
pass: `${process.env.MAIL_PASSWORD}`
},
tls: {
ciphers: 'SSLv3'
}
});
path = require('path')
console.log("Current directory:", __dirname);
let reqPath = path.join(__dirname, '../../mercari/build/dependencyUpdates/report.html')
console.log("reqPath :", reqPath);
const report = require('fs').readFileSync(reqPath)
const mailOptions = {
from: {
name: 'GitHubRepos',
address: process.env.MAIL_USERNAME
},
to: 'khalid64927@gmail.com', // Use your main account to get the email
subject: 'Dependency update report of AndroidCore ¯\\_(ツ)_/¯',
text: `${report}`,
attachments : [
{ // utf-8 string as an attachment
filename: 'build.gradle.kts',
path: reqPath
}
]
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.log(error)
}
});
}