mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2025-07-03 05:33:14 +07:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
6d23605227 | |||
f5b1987fb0 | |||
9020e79ee7 | |||
ba46013833 | |||
fd76768b61 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.idea
|
13
README.md
13
README.md
@ -42,6 +42,8 @@ Some features:
|
||||
bcc: r2d2@example.com,hansolo@example.com
|
||||
# Optional recipient of the email response:
|
||||
reply_to: luke@example.com
|
||||
# Optional Message ID this message is replying to:
|
||||
in_reply_to: <random-luke@example.com>
|
||||
# Optional unsigned/invalid certificates allowance:
|
||||
ignore_cert: true
|
||||
# Optional converting Markdown to HTML (set content_type to text/html too):
|
||||
@ -56,14 +58,11 @@ Some features:
|
||||
|
||||
### Gmail
|
||||
|
||||
Gmail security settings may cause this Action to fail. This failure may involve a message in the GitHub Actions details about access being denied and an email from Google to the email account being used about a sign-in being blocked and why.
|
||||
Instead of using your normal Google password, use an App password.
|
||||
|
||||
Changes in Gmail settings may be necessary to get this action to work.
|
||||
1. Google treats this method of using email as a "Less Secure App". However, "Less Secure Apps" can be enabled in Google profile settings. There doesn't appear to be a static link for this, but if you go to Google profile settings while signed-in and type "less secure apps" into the search bar, the appropriate instructions will come up.
|
||||
2. IMAP needs to be enabled in Gmail settings as described [here](https://support.google.com/mail/answer/7126229?hl=en).
|
||||
3. If the Gmail account you're trying to use in this Action is already 2FA (Two Factor Authentication) enabled, the 2FA password will need to be provided as well, which isn't included in the default template.
|
||||
|
||||
Users who have had problems have reported success by doing each of these three steps or by doing the first two steps and using a Gmail account that didn't have 2FA enabled.
|
||||
1. [Enable 2-Step Verification.](https://support.google.com/accounts/answer/185839?hl=en&co=GENIE.Platform%3DAndroid).
|
||||
This is needed to create an App password.
|
||||
2. [Create an App password](https://support.google.com/accounts/answer/185833?hl=en) for `Mail`.
|
||||
|
||||
### Unauthenticated login (username/password fields)
|
||||
|
||||
|
@ -44,6 +44,9 @@ inputs:
|
||||
reply_to:
|
||||
description: An email address that will appear on the Reply-To field
|
||||
required: false
|
||||
in_reply_to:
|
||||
description: The Message-ID this message is replying to
|
||||
required: false
|
||||
ignore_cert:
|
||||
description: Allow unsigned/invalid certificates
|
||||
required: false
|
||||
|
6
main.js
6
main.js
@ -3,6 +3,7 @@ const core = require("@actions/core")
|
||||
const glob = require("@actions/glob")
|
||||
const fs = require("fs")
|
||||
const showdown = require("showdown")
|
||||
const path = require("path")
|
||||
|
||||
function getBody(bodyOrFile, convertMarkdown) {
|
||||
let body = bodyOrFile
|
||||
@ -33,7 +34,7 @@ function getFrom(from, username) {
|
||||
async function getAttachments(attachments) {
|
||||
const globber = await glob.create(attachments.split(',').join('\n'))
|
||||
const files = await globber.glob()
|
||||
return files.map(f => ({ path: f, cid: f.replace(/^.*[\\\/]/, '')}))
|
||||
return files.map(f => ({ filename: path.basename(f), path: f, cid: f.replace(/^.*[\\\/]/, '')}))
|
||||
}
|
||||
|
||||
async function main() {
|
||||
@ -51,6 +52,7 @@ async function main() {
|
||||
const cc = core.getInput("cc", { required: false })
|
||||
const bcc = core.getInput("bcc", { required: false })
|
||||
const replyTo = core.getInput("reply_to", { required: false })
|
||||
const inReplyTo = core.getInput("in_reply_to", { required: false })
|
||||
const attachments = core.getInput("attachments", { required: false })
|
||||
const convertMarkdown = core.getInput("convert_markdown", { required: false })
|
||||
const ignoreCert = core.getInput("ignore_cert", { required: false })
|
||||
@ -80,6 +82,8 @@ async function main() {
|
||||
cc: cc ? cc : undefined,
|
||||
bcc: bcc ? bcc : undefined,
|
||||
replyTo: replyTo ? replyTo : undefined,
|
||||
inReplyTo: inReplyTo ? inReplyTo : undefined,
|
||||
references: inReplyTo ? inReplyTo : undefined,
|
||||
text: body ? getBody(body, false) : undefined,
|
||||
html: htmlBody ? getBody(htmlBody, convertMarkdown) : undefined,
|
||||
priority: priority ? priority : undefined,
|
||||
|
14
package-lock.json
generated
14
package-lock.json
generated
@ -6,7 +6,7 @@
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.7",
|
||||
"@actions/glob": "^0.2.0",
|
||||
"@actions/glob": "^0.2.1",
|
||||
"nodemailer": "^6.4.17",
|
||||
"showdown": "^1.9.1"
|
||||
}
|
||||
@ -17,9 +17,9 @@
|
||||
"integrity": "sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg=="
|
||||
},
|
||||
"node_modules/@actions/glob": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.2.0.tgz",
|
||||
"integrity": "sha512-mqE2a7I66kxcvsdwxs/filQwZsq25IfktMaviGfDB51v6Q3bvxnV7mFsZnvYtLhqGZbPxwBnH8AD3UYaOWb//w==",
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.2.1.tgz",
|
||||
"integrity": "sha512-OqseGbxR8vVikg6rfdKST21GX3QYGq2Nz7/gX3UxZb2Mw1ujJ2S3U5CsYUvYHwxbYguU+HNhfE3930oo5nprXQ==",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"minimatch": "^3.0.4"
|
||||
@ -317,9 +317,9 @@
|
||||
"integrity": "sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg=="
|
||||
},
|
||||
"@actions/glob": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.2.0.tgz",
|
||||
"integrity": "sha512-mqE2a7I66kxcvsdwxs/filQwZsq25IfktMaviGfDB51v6Q3bvxnV7mFsZnvYtLhqGZbPxwBnH8AD3UYaOWb//w==",
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.2.1.tgz",
|
||||
"integrity": "sha512-OqseGbxR8vVikg6rfdKST21GX3QYGq2Nz7/gX3UxZb2Mw1ujJ2S3U5CsYUvYHwxbYguU+HNhfE3930oo5nprXQ==",
|
||||
"requires": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"minimatch": "^3.0.4"
|
||||
|
@ -3,7 +3,7 @@
|
||||
"main": "main.js",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.7",
|
||||
"@actions/glob": "^0.2.0",
|
||||
"@actions/glob": "^0.2.1",
|
||||
"nodemailer": "^6.4.17",
|
||||
"showdown": "^1.9.1"
|
||||
}
|
||||
|
Reference in New Issue
Block a user