send email on the command line

forest johnson 0ed2a3e0a8 readme 2 years ago
Dockerfile 5f6ea5512b first try 2 years ago
ReadMe.md 0ed2a3e0a8 readme 2 years ago
index.js 96fc795c20 blah 2 years ago
package.json 585a336d65 blah 2 years ago

ReadMe.md

Example usage:

#!/bin/bash

CURRENT_PUBLIC_IP=$(dig @ns1.google.com -t txt o-o.myaddr.l.google.com +short)
LAST_PUBLIC_IP=$(cat last-public-ip.txt)
if [ "$CURRENT_PUBLIC_IP" != "$LAST_PUBLIC_IP" ]; then
  docker run -e "GMAIL_USER=xxxxxxx" \
    -e "GMAIL_PASSWORD=xxxxxxx" \
    -e "EMAIL_NOTIFICATION_TARGET=xxxxxxx" \
    emailer:0.0.1 node /usr/src/app/index.js "Ip Address Change" $CURRENT_PUBLIC_IP

fi

echo $CURRENT_PUBLIC_IP > last-public-ip.txt