#!/bin/sh #----------------------------------------------------------------------------- # /var/install/bin/ssmtp-send-testmail - send mail to test sSMTP configuration # # Copyright (c) 2008-2010 Stefan Goldbach, stefan(at)altergraben(dot)de # Copyright (c) 2011-2023 The Eisfair Team, team(at)eisfair(dot)org # # Creation : 2008-08-29 sg # Last Update: $Id$ # # 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. #----------------------------------------------------------------------------- # load eislib etc. . /var/install/include/eislib embedded=0 if [ "$1" = '--embedded' ] then embedded=1 shift else clrhome mecho --info "sSMTP test mail" echo fi ssmtp_error=/tmp/ssmtp-error.$$ # load configuration . /etc/config.d/ssmtp if [ -z "${SSMTP_HOSTNAME}" ] then SSMTP_HOSTNAME="`hostname --fqdn`" fi echo -n "Sending test mail to '" mecho -n --warn "${SSMTP_FORWARD_TO}" echo -n "' " { echo "From: sSMTP mail Agent " echo "To: <${SSMTP_FORWARD_TO}>" echo "Mime-Version: 1.0" echo "X-Mailer: sendmail sSMTP on eisfair" echo "Content-Type: text/plain; charset=us-ascii" echo "Content-Transfer-Encoding: 8bit" echo "Subject: sSMTP test mail from server '${HOSTNAME}'" echo echo "Dispatched from sSMTP mail Agent on Server '${HOSTNAME}'" echo "Current Date: ${EISDATE} Time: ${EISTIME}" echo echo "This mail was forwarded to ${SSMTP_FORWARD_TO}" echo "using the mailhub '${SSMTP_MAILHUB}'." echo } | /usr/sbin/sendmail ${SSMTP_FORWARD_TO} 2> ${ssmtp_error} sleep 1 echo -n "." sleep 1 echo -n "." sleep 1 echo -n "." sleep 1 message=`cat ${ssmtp_error} | sed 's#send-mail:\(.\+\)#\1#'` if [ -n "${message}" ] then mecho mecho --error ${message} mecho /var/install/bin/ask "Edit configuration?" "yes" if [ $? = 0 ] then clrhome /var/install/bin/edit --apply /etc/config.d/ssmtp fi else mecho --info " done." if [ ${embedded} -eq 0 ] then echo anykey fi fi rm -f ${ssmtp_error} exit 0