3 Commits

Author SHA1 Message Date
48476814b0 Made "to" optional (incase cc or bcc is provided) (#183)
* Added made to optional (incase cc or bcc is provided)

* updated action.yml
2023-09-27 08:49:06 +02:00
e3f3ba4f86 build(deps): bump actions/checkout from 3 to 4 (#179)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 08:47:40 +02:00
19516a4a58 fix #176 by removing useless warning message (#177) 2023-08-19 08:57:30 +02:00
3 changed files with 9 additions and 8 deletions

View File

@ -42,7 +42,7 @@ jobs:
html_body: file://README.md
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Send mail
uses: ./
with:
@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Send mail
uses: ./
with:

View File

@ -23,7 +23,7 @@ inputs:
required: true
to:
description: Recipients mail addresses (separated with comma)
required: true
required: false
from:
description: Full name of mail sender (might be with an email address specified in <>)
required: true

11
main.js
View File

@ -80,7 +80,7 @@ async function main() {
const subject = core.getInput("subject", { required: true })
const from = core.getInput("from", { required: true })
const to = core.getInput("to", { required: true })
const to = core.getInput("to", { required: false })
const body = core.getInput("body", { required: false })
const htmlBody = core.getInput("html_body", { required: false })
const cc = core.getInput("cc", { required: false })
@ -92,14 +92,15 @@ async function main() {
const ignoreCert = core.getInput("ignore_cert", { required: false })
const priority = core.getInput("priority", { required: false })
// if neither to, cc or bcc is provided, throw error
if (!to && !cc && !bcc) {
throw new Error("At least one of 'to', 'cc' or 'bcc' must be specified")
}
if (!serverAddress) {
throw new Error("Server address must be specified")
}
if (!username || !password) {
core.warning("Username and password not specified. You should only do this if you are using a self-hosted runner to access an on-premise mail server.")
}
const transport = nodemailer.createTransport({
host: serverAddress,
auth: username && password ? {