https://github.com/actcoding/smtp-cli
📨 Send emails right from your terminal.
https://github.com/actcoding/smtp-cli
Last synced: 4 months ago
JSON representation
📨 Send emails right from your terminal.
- Host: GitHub
- URL: https://github.com/actcoding/smtp-cli
- Owner: actcoding
- License: mit
- Created: 2024-09-28T19:05:22.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-29T19:50:01.000Z (about 1 year ago)
- Last Synced: 2025-03-14T22:54:46.840Z (7 months ago)
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# smtp-cli
> 📨 Send emails right from your terminal.
We use this tool to send an informational email whenever someone logs in to one of our servers.
Intended usage is via [pam_exec(8)](https://linux.die.net/man/8/pam_exec).Emails are sent directly via SMTP. The config is read from a json file, see [Config](#config).
The message body is produced via go templates, see [Templates](#templates).
## Installation
Download an archive (`.tar.gz`) from the latest release and run the `install.sh` script.
## Usage
Add the following snippet to `/etc/pam.d/sshd`:
```
session required pam_exec.so /usr/local/bin/smtp-cli -config /usr/local/etc/smtp-cli/config.json -template /usr/local/etc/smtp-cli/template.gotmpl
```## Config
```json
{
"host": "mail.example.org",
"port": 465,
"username": "no-reply@example.org",
"password": "",
"from": "monitor ",
"to": [
"info "
],
"subject": "New login to the server"
}
```## Templates
The following variables are made available to the go template:
| Variable | Type |
| --- | --- |
| Host | string |
| User | string |
| RemoteUser | string |
| RemoteHost | string |
| Tty | string |
| Timestamp | time.Time |## License
[MIT](LICENSE)