summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-04-01 13:58:07 +0200
committerErich Eckner <git@eckner.net>2016-04-01 13:58:07 +0200
commit2461fdc81e4b7a35698b207c064f2eca1c7d3ec4 (patch)
tree406e5ad5d40528cdb7b41c4ec8fd6f2904fe97c2
parent4cca1654c13e57f5a2e01d0e18a8255e98bad621 (diff)
downloadsendmailadvanced-2461fdc81e4b7a35698b207c064f2eca1c7d3ec4.tar.xz
mailer aus Liste wählen
-rwxr-xr-xsendmailadvanced18
1 files changed, 17 insertions, 1 deletions
diff --git a/sendmailadvanced b/sendmailadvanced
index 64a0152..37b73e8 100755
--- a/sendmailadvanced
+++ b/sendmailadvanced
@@ -1,5 +1,21 @@
#!/bin/bash
+MAILER="cantfind"
+
+for executable in sendmail msmtp
+do
+ for prefix in /usr/bin /usr/sbin /bin /sbin
+ do
+ [ "${MAILER}" == "cantfind" ] && [ -x ${prefix}/${executable} ] && MAILER="${prefix}/${executable}"
+ done
+done
+
+if [ "${MAILER}" == "cantfind" ]
+then
+ >&2 echo 'ERROR: Can\'t find suitable mailer.'
+ exit 1
+fi
+
(
. /etc/sendmailadvanced.conf
@@ -30,4 +46,4 @@
cat
body_footer_hook $@
) | gpg -e -a -s -r ${gpg_recipient}
-) | /usr/sbin/sendmail -t
+) | ${MAILER} -t