mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2025-07-01 20:53:14 +07:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
a80d851dc9 | |||
37c6a4d431 | |||
edca34ffa5 | |||
4effcb0f30 | |||
72d529bf7f | |||
bd1a6a6dc3 |
12
main.js
12
main.js
@ -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
12
package-lock.json
generated
@ -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=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user