2019-11-18 19:23:22 +07:00
# Send mail Github Action
2019-11-18 19:05:04 +07:00
2019-11-18 19:23:22 +07:00
An action that simply sends a mail to multiple recipients.
2019-11-18 19:05:04 +07:00
2021-04-25 21:45:57 +07:00
Some features:
- plain text body
- HTML body
- multipart body (plain text + HTML)
2023-01-26 15:07:49 +07:00
- Markdown to HTML converting (use `html_body` , not `body` )
2021-07-13 23:23:48 +07:00
- file attachments (supports globbing)
2021-04-25 21:45:57 +07:00
2019-11-18 19:23:22 +07:00
## Usage
```yaml
- name: Send mail
2021-04-25 21:45:57 +07:00
uses: dawidd6/action-send-mail@v3
2019-11-18 19:23:22 +07:00
with:
2022-09-09 23:53:48 +07:00
# Specify connection via URL (replaces server_address, server_port, secure,
# username and password)
#
# Format:
#
# * smtp://user:password@server:port
# * smtp+starttls://user:password@server:port
connection_url: ${{secrets.MAIL_CONNECTION}}
# Required mail server address if not connection_url:
2019-11-18 19:23:22 +07:00
server_address: smtp.gmail.com
2022-09-09 23:53:48 +07:00
# Server port, default 25:
2019-11-18 19:23:22 +07:00
server_port: 465
2022-09-09 23:53:48 +07:00
# Optional whether this connection use TLS (default is true if server_port is 465)
secure: true
2023-01-05 17:39:58 +07:00
# Optional (recommended) mail server username:
2019-11-18 19:23:22 +07:00
username: ${{secrets.MAIL_USERNAME}}
2021-06-15 01:04:27 +07:00
# Optional (recommended) mail server password:
2019-11-18 19:23:22 +07:00
password: ${{secrets.MAIL_PASSWORD}}
2021-04-25 21:11:54 +07:00
# Required mail subject:
2019-11-18 19:23:22 +07:00
subject: Github Actions job result
2021-04-25 21:11:54 +07:00
# Required recipients' addresses:
2021-02-23 04:16:12 +07:00
to: obiwan@example.com,yoda@example.com
2021-04-25 21:30:16 +07:00
# Required sender full name (address can be skipped):
2020-03-25 22:30:22 +07:00
from: Luke Skywalker # < user @ example . com >
2021-04-25 21:11:54 +07:00
# Optional plain body:
body: Build job of ${{github.repository}} completed successfully!
# Optional HTML body read from file:
html_body: file://README.html
# Optional carbon copy recipients:
2021-02-23 04:16:12 +07:00
cc: kyloren@example.com,leia@example.com
2021-04-25 21:11:54 +07:00
# Optional blind carbon copy recipients:
2021-02-23 04:16:12 +07:00
bcc: r2d2@example.com,hansolo@example.com
2021-04-25 21:11:54 +07:00
# Optional recipient of the email response:
2021-04-08 00:34:58 +07:00
reply_to: luke@example.com
2021-10-17 14:45:58 +07:00
# Optional Message ID this message is replying to:
in_reply_to: < random-luke @ example . com >
2021-04-02 05:02:58 +07:00
# Optional unsigned/invalid certificates allowance:
ignore_cert: true
2020-12-01 00:51:34 +07:00
# Optional converting Markdown to HTML (set content_type to text/html too):
convert_markdown: true
2020-04-07 15:36:16 +07:00
# Optional attachments:
2021-07-13 23:23:48 +07:00
attachments: attachments.zip,git.diff,./dist/static/*.js
2021-07-02 23:33:56 +07:00
# Optional priority: 'high', 'normal' (default) or 'low'
priority: low
2019-11-18 19:23:22 +07:00
```
2021-04-14 01:24:22 +07:00
## Troubleshooting
### Gmail
2022-03-19 04:58:04 +07:00
Instead of using your normal Google password, use an App password.
2021-04-14 01:24:22 +07:00
2022-03-19 04:58:04 +07:00
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` .
2021-06-15 01:04:27 +07:00
### Unauthenticated login (username/password fields)
The parameters `username` and `password` are set as optional to support self-hosted runners access to on-premise infrastructure. If
you are accessing public email servers make sure you provide a username/password authentication through [GitHub Secrets ](https://docs.github.com/en/actions/reference/encrypted-secrets ) to make the email delivery secure.