From 2461fdc81e4b7a35698b207c064f2eca1c7d3ec4 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 1 Apr 2016 13:58:07 +0200 Subject: mailer aus Liste wählen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sendmailadvanced | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2