Skip to content

Instantly share code, notes, and snippets.

@jdb8
Last active August 29, 2015 14:18
Show Gist options
  • Save jdb8/f03bd8ef2b474c6d111a to your computer and use it in GitHub Desktop.
Save jdb8/f03bd8ef2b474c6d111a to your computer and use it in GitHub Desktop.
A simple hacky script to send an email via sendmail. This can be used as the supplied command for znc-push.
#!/bin/sh
EMAIL="you@example.com"
NEAT_DATE=`date +%Y-%m-%d`
FULL_DATE=`date +%Y-%m-%d:%H:%M:%S`
SUBJECT="New IRC Notification: $NEAT_DATE"
SENDER="ZNC-Push"
FOOTER="Received on $FULL_DATE"
MESSAGE=$(echo "$1" | tr -d '\011\012\015') # Remove tabs, carriage returns and newlines
echo "Emailing $EMAIL..."
echo "Message: $MESSAGE"
echo "Subject:$SUBJECT\n\n$MESSAGE\n\n$FOOTER" | sendmail -F "$SENDER" "$EMAIL"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment