Skip to content

Instantly share code, notes, and snippets.

@tiramiseb
Created April 4, 2017 19:24
Show Gist options
  • Save tiramiseb/7a059dab4bf506021bade97c14f16e07 to your computer and use it in GitHub Desktop.
Save tiramiseb/7a059dab4bf506021bade97c14f16e07 to your computer and use it in GitHub Desktop.
Send bank account history by mail
#!/bin/sh
#
# 1. Install weboob
# 2. Execute boobank
# 3. Follow instructions to connect to your bank account
# 4. Execute "boobank list" in order to obtain the account id
acctid="<boobank account id>"
mailto="<recipient1> <recipient2> [...]"
subject="<mail subject>"
tmpfile=$(tempfile)
echo "<html>
<head>
<style>
table {
border-collapse: collapse;
}
th, td {
border: 1px solid #000;
padding: 3px;
}
</style>
</head>
<body>" > $tmpfile
boobank --formatter=htmltable --select=label,balance list >> $tmpfile 2>/dev/null
boobank --formatter=htmltable --select=date,label,amount history $acctid >> $tmpfile 2>/dev/null
echo "</body>
</html>" >> $tmpfile
cat $tmpfile | mail -a "Content-type: text/html" -s "$subject" $mailto
rm $tmpfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment