Skip to content

Instantly share code, notes, and snippets.

@vekvoid
Created August 31, 2016 17:20
Show Gist options
  • Save vekvoid/54cc932d4c9ce2ea611827d59ac208ea to your computer and use it in GitHub Desktop.
Save vekvoid/54cc932d4c9ce2ea611827d59ac208ea to your computer and use it in GitHub Desktop.
Send a email with a image marked as favorite on Variety.
#! /bin/bash
inotifywait -m ~/.config/variety/Favorites --exclude \.json -e create -e moved_to |
while read path action file; do
echo "The file '$file' appeared in directory '$path' via '$action'"
# do something with the file
SERVER_PORT="smtp.sendgrid.net:587"
SENDER="from@example.com"
RESEIVER="to@example.com"
USER="apikey"
PASSWORD="sendgridApiKey"
swaks --to $RESEIVER --from $SENDER --server $SERVER_PORT --auth LOGIN --auth-user $USER --auth-password $PASSWORD -S -tls --header "Subject: New image" --body "New image bookmarked." --attach "$path$file"
echo "$path$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment