Created
April 6, 2017 08:05
-
-
Save Neo-Oli/99dcc837fe9c62eca5bc1814edd3a228 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/data/data/com.termux/files/usr/bin/bash | |
set -e | |
files=`find $HOME/mail/.outbox -type f` | |
if [ -n "$files" ];then | |
lockdir="$PREFIX/var/run/`basename $0`.lock" | |
if mkdir "$lockdir" | |
then | |
#echo >&2 "successfully acquired lock: $lockdir" | |
trap 'rm -rf "$lockdir"' 0 | |
else | |
echo >&2 "cannot acquire lock, giving up on $lockdir" | |
exit 0 | |
fi | |
for f in $files;do | |
echo "Sending $f" | |
cat $f|sendmail -t -f <my-email-adress> -S <mailserver>:<port> -au<username> -ap<password> | |
mv $f ~/mail/.sent/cur/ | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment