app/notes/20200302-0205.md
Sendmail Wrapper for Mailgun
sendmail-mailgun
1583114700
If you use the `sendmail` linux CLI and you want to route outgoing emails
through mailgun, write this file, make it executable, and add it to your
path before the actual exectuable is found:
```bash
#!/bin/bash
# Shim for netdata to send emails through mailgun
# filename: sendmail
# suggested location: /usr/local/bin/
# Installation:
# 1. Write the contents of this script to a file called "sendmail"
# 2. Fill in the mailgun smtp email and password from https://app.mailgun.com/app/sending/domains/albertyw.com/credentials
# 3. sed -i 's/SENDMAIL_PATH_REPLACE_ME/$(mailgun)/g' sendmail
# 4. `chmod +x sendmail`
# 5. `sudo mv -n sendmail /usr/local/bin`
SENDMAIL_PATH="SENDMAIL_PATH_REPLACE_ME"
MAILGUN_EMAIL="REPLACE_ME"
MAILGUN_PASSWORD="REPLACE_ME"
# shellcheck disable=SC2068
"$SENDMAIL_PATH" \
-S smtp.mailgun.org \
-au "$MAILGUN_EMAIL" \
-ap "$MAILGUN_PASSWORD" \
$@
```