Skip to content

Instantly share code, notes, and snippets.

@adzhurinskij
Last active April 19, 2016 12:11
Show Gist options
  • Save adzhurinskij/60f96d8ab3fd6b1e455f to your computer and use it in GitHub Desktop.
Save adzhurinskij/60f96d8ab3fd6b1e455f to your computer and use it in GitHub Desktop.
Swaks for Zabbix (use SMTP and TLS)
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOST=smtp.yandex.ru
USERNAME=username@yandex.ru
PASSWORD=password
PORT=465
TO=$1
SUBJECT=$2
BODY=$3
SWAKS=`which swaks`
$SWAKS --to $TO --from $USERNAME --h-From: "'Zabbix' <$USERNAME>" --body "$BODY" --h-Subject $SUBJECT \
--server $HOST --port $PORT --protocol SSMTP \
--auth LOGIN --auth-user $USERNAME --auth-password $PASSWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment