mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-09-17 09:06:48 +07:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ca8dbb4d4f | |||
| 8043a5ab22 |
@@ -16,8 +16,8 @@ Some features:
|
||||
- name: Send mail
|
||||
uses: dawidd6/action-send-mail@<REF>
|
||||
env:
|
||||
# Optional http proxy:
|
||||
HTTP_PROXY: http://proxy.example.test:3128
|
||||
# Optional proxy, NO_PROXY is honored too:
|
||||
SMTP_PROXY: http://proxy.example.test:3128
|
||||
with:
|
||||
# Specify connection via URL (replaces server_address, server_port, secure,
|
||||
# username and password)
|
||||
|
||||
@@ -6,6 +6,22 @@ import fs from "node:fs";
|
||||
import showdown from "showdown";
|
||||
import path from "node:path";
|
||||
|
||||
// smtp_proxy or smtps_proxy, exempted by no_proxy, each preferred lowercase like curl.
|
||||
function getProxy(host) {
|
||||
const env = (name) => process.env[name] || process.env[name.toUpperCase()];
|
||||
|
||||
const proxy = env("smtp_proxy") || env("smtps_proxy");
|
||||
if (!proxy) return undefined;
|
||||
|
||||
host = `.${host.toLowerCase()}`;
|
||||
const excluded = (env("no_proxy") || "")
|
||||
.split(",")
|
||||
.map((entry) => entry.trim().replace(/^\./, "").toLowerCase())
|
||||
.some((entry) => entry && (entry === "*" || host.endsWith(`.${entry}`)));
|
||||
|
||||
return excluded ? undefined : proxy;
|
||||
}
|
||||
|
||||
function getText(textOrFile, convertMarkdown) {
|
||||
let text = textOrFile;
|
||||
|
||||
@@ -188,7 +204,7 @@ async function main() {
|
||||
: undefined,
|
||||
logger: nodemailerdebug == "true" ? true : nodemailerlog,
|
||||
debug: nodemailerdebug,
|
||||
proxy: process.env.HTTP_PROXY,
|
||||
proxy: getProxy(serverAddress),
|
||||
});
|
||||
|
||||
const messageOptions = {
|
||||
|
||||
Generated
+5
-5
@@ -8,7 +8,7 @@
|
||||
"dependencies": {
|
||||
"@actions/core": "^3.0.1",
|
||||
"@actions/glob": "^0.7.0",
|
||||
"nodemailer": "^9.1.1",
|
||||
"nodemailer": "^10.0.0",
|
||||
"showdown": "^2.1.0"
|
||||
}
|
||||
},
|
||||
@@ -103,12 +103,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "9.1.1",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-9.1.1.tgz",
|
||||
"integrity": "sha512-izw9mVKFix6YSnC9eLgV6g1opl9DUlRio9ZNcq+Wu9Ujn2UwF+8Nl0B8nz22kEC+CTZCvinkxwJ0DeFbb6NwcQ==",
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.0.0.tgz",
|
||||
"integrity": "sha512-wdv+hXBg0iIPIOf108FaZyTxqjQpCvQeAJt9pHHTooPy/y3vQtI9eiImM9AIVKR3e/0FeMA1oueNfBjFJcaK+Q==",
|
||||
"license": "MIT-0",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
"node": ">=20.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/showdown": {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
"dependencies": {
|
||||
"@actions/core": "^3.0.1",
|
||||
"@actions/glob": "^0.7.0",
|
||||
"nodemailer": "^9.1.1",
|
||||
"nodemailer": "^10.0.0",
|
||||
"showdown": "^2.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user