6 Commits

Author SHA1 Message Date
a80d851dc9 Merge pull request #19 from dawidd6/dependabot-npm_and_yarn-nodemailer-6.4.12
build(deps): bump nodemailer from 6.4.11 to 6.4.12
2020-10-01 10:23:59 +02:00
37c6a4d431 build(deps): bump nodemailer from 6.4.11 to 6.4.12
Bumps [nodemailer](https://github.com/nodemailer/nodemailer) from 6.4.11 to 6.4.12.
- [Release notes](https://github.com/nodemailer/nodemailer/releases)
- [Changelog](https://github.com/nodemailer/nodemailer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodemailer/nodemailer/compare/v6.4.11...v6.4.12)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-01 00:26:37 +00:00
edca34ffa5 main: log only transport options 2020-09-24 10:27:30 +02:00
4effcb0f30 main: log transport 2020-09-24 10:24:29 +02:00
72d529bf7f Merge pull request #18 from dawidd6/dependabot-npm_and_yarn-actions-core-1.2.6
build(deps): bump @actions/core from 1.2.5 to 1.2.6
2020-09-24 10:13:01 +02:00
bd1a6a6dc3 build(deps): bump @actions/core from 1.2.5 to 1.2.6
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-23 23:54:17 +00:00
3 changed files with 15 additions and 13 deletions

12
main.js
View File

@ -2,7 +2,7 @@ const nodemailer = require("nodemailer")
const core = require("@actions/core")
const fs = require("fs")
function get_body(body) {
function getBody(body) {
if (body.startsWith("file://")) {
const file = body.replace("file://", "")
return fs.readFileSync(file, "utf8")
@ -11,7 +11,7 @@ function get_body(body) {
return body
}
function get_from(from, username) {
function getFrom(from, username) {
if (from.match(/.+<.+@.+>/)) {
return from
}
@ -42,12 +42,14 @@ async function main() {
}
})
console.log(transport.options)
const info = await transport.sendMail({
from: get_from(from, username),
from: getFrom(from, username),
to: to,
subject: subject,
text: content_type != "text/html" ? get_body(body) : undefined,
html: content_type == "text/html" ? get_body(body) : undefined,
text: content_type != "text/html" ? getBody(body) : undefined,
html: content_type == "text/html" ? getBody(body) : undefined,
attachments: attachments ? attachments.split(',').map(f => ({ path: f.trim() })) : undefined
})

12
package-lock.json generated
View File

@ -5,14 +5,14 @@
"requires": true,
"dependencies": {
"@actions/core": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.5.tgz",
"integrity": "sha512-mwpoNjHSWWh0IiALdDEQi3tru124JKn0yVNziIBzTME8QRv7thwoghVuT1jBRjFvdtoHsqD58IRHy1nf86paRg=="
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
},
"nodemailer": {
"version": "6.4.11",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.4.11.tgz",
"integrity": "sha512-BVZBDi+aJV4O38rxsUh164Dk1NCqgh6Cm0rQSb9SK/DHGll/DrCMnycVDD7msJgZCnmVa8ASo8EZzR7jsgTukQ=="
"version": "6.4.12",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.4.12.tgz",
"integrity": "sha512-c/WplZp24Lxc+hn0w/kweNxcYGpaqtH1iecfGKTbXVmp5qx+ILApKsmCAucWWIIQiYKKH4ZA/ffSNOsai6xJGA=="
}
}
}

View File

@ -17,7 +17,7 @@
},
"homepage": "https://github.com/dawidd6/action-send-mail#readme",
"dependencies": {
"@actions/core": "^1.2.5",
"nodemailer": "^6.4.11"
"@actions/core": "^1.2.6",
"nodemailer": "^6.4.12"
}
}