#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/msmtp-send-testmail - send mail to test msmtp configuration # # Creation : 2011-10-08 hbfl # Last Update: $Id$ # # Copyright (c) 2011-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- . /var/install/include/eislib . /etc/config.d/msmtp mailaddr="${MSMTP_MAIL_SND_TO}" msmtp_error=/tmp/msmtp-error sendmail=/usr/sbin/sendmail full_domain=$(hostname -f) echo mecho -n --info "Sending test mail to " mecho -n "${mailaddr} " { echo "From: msmtp mail Agent " echo "To: <${mailaddr}>" echo "Subject: msmtp test mail from Server '${HOSTNAME}'" echo "Mime-Version: 1.0" echo "X-Mailer: sendmail msmtp on eisfair" echo "Content-Type: text/plain; charset=us-ascii" echo "Content-Transfer-Encoding: 8bit" echo echo echo "Dispatched from msmtp mail Agent on Server '${HOSTNAME}'" echo "Current Date: ${EISDATE} Time: ${EISTIME}" echo echo "This mail was forwarded to ${mailaddr}" echo "using the mailhub '${MSMTP_MAIL_HOST}'." echo } | ${sendmail} ${mailaddr} 2>${msmtp_error} sleep 0.3 mecho -n --info "." sleep 0.3 mecho -n --info "." sleep 0.3 mecho -n --info "." sleep 0.3 echo if [ -f ${msmtp_error} ] then message="$(cat ${msmtp_error} | sed 's#sendmail:\(.\+\)#\1#')" fi if [ -n "${message}" ] then mecho --fail echo mecho --error "${message}" echo anykey else mecho --ok echo anykey fi rm -f ${msmtp_error}