forked from flickerfly/taskwarrior-notifications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
task-ansi2email.sh
executable file
·36 lines (30 loc) · 1015 Bytes
/
task-ansi2email.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# email myself info about upcoming tasks in a pretty HTML format
# Basic idea conceived by Kevin Owens at:
# http://taskwarrior.org/boards/1/topics/495#message-552
# Requires ssmtp and ansi2html script. It should be easy to substitute
# another smtp program, if you do, please let me know and I'll update this
# cron: 30 5 * * 1-6 /home/user/bin/taskwarrior-notifications/task-email.sh
# Pull in the config variables
dir="$( cd "$( dirname "$0" )" && pwd )"
if [ -f $dir/config ]
then
source $dir/config
else
echo "No configuration file found. Maybe you need to copy and edit the example.config file to config."
exit 1
fi
#setup headers so the HTML shows properly
cat > $tmp_email <<EOF
From: The Task List <$sendto>
To: $sendto
Subject: Daily Task Email
MIME-Version: 1.0
Content-Type: text/html
Content-Disposition: inline
EOF
#pump the task information into the email
task $report | $scripts/ansi2html.sh >> $tmp_email
# Send the email
$mail_prog $sendto < $tmp_email
rm $tmp_email