summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-04-01 09:40:29 +0200
committerErich Eckner <git@eckner.net>2016-04-01 09:40:29 +0200
commit4cca1654c13e57f5a2e01d0e18a8255e98bad621 (patch)
tree1ba2c7b4b5c980c3798182a6140b0ebc716c0f28
downloadsendmailadvanced-4cca1654c13e57f5a2e01d0e18a8255e98bad621.tar.xz
Initial Commit
-rwxr-xr-xsendmailadvanced33
-rwxr-xr-xsendmailadvanced.conf38
2 files changed, 71 insertions, 0 deletions
diff --git a/sendmailadvanced b/sendmailadvanced
new file mode 100755
index 0000000..64a0152
--- /dev/null
+++ b/sendmailadvanced
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+(
+ . /etc/sendmailadvanced.conf
+
+ tos=""
+ while read s
+ do
+ echo "${s}"
+ if [ "${s:0:3}" == "To:" ] || [ "${s:0:3}" == "Cc:" ]
+ then
+ tos="${tos} ${s:4}"
+ fi
+ if [ "${s:0:8}" == "Subject:" ]
+ then
+ break
+ fi
+ done
+ hashcash -b ${hashcash_bits} -Xm ${tos}
+ while read s
+ do
+ echo "${s}"
+ if [ "${s}" == "" ]
+ then
+ break
+ fi
+ done
+ (
+ body_header_hook $@
+ cat
+ body_footer_hook $@
+ ) | gpg -e -a -s -r ${gpg_recipient}
+) | /usr/sbin/sendmail -t
diff --git a/sendmailadvanced.conf b/sendmailadvanced.conf
new file mode 100755
index 0000000..7b37bfc
--- /dev/null
+++ b/sendmailadvanced.conf
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# configuration for sendmailadvanced
+
+# default recipient to encrypt to
+gpg_recipient="me@example.com"
+
+# stamp value
+hashcash_bits=22
+
+# things to put into head of (body of) email
+body_header_hook()
+{
+ true
+}
+
+# things to put into foot of email
+body_footer_hook()
+{
+ while [ $# -gt 0 ]
+ do
+ if [ "$1" == "-t" ]
+ then
+ true
+ elif [ "$(whoami)" == "root" ] && [ "$1" == "-wb" ]
+ then
+ echo "----------------------- Last Backups Begin -------------------------"
+ echo
+ lastBackups
+ echo
+ echo "------------------------ Last Backups End --------------------------"
+ echo
+ else
+ echo "Unknown option: '$1'"
+ fi
+ shift
+ done
+}