Add a sendmail every time a rejected email is found

This commit is contained in:
myve 2025-02-25 22:34:27 +00:00
commit 9e4093fea1
3 changed files with 42 additions and 22 deletions

View file

@ -6,9 +6,9 @@ set -e
trap '[ "${?}" -ne 77 ] || exit 77' ERR
function die
{
local reset="\e[0m"
local red="\e[0m\e[0;31m"
local yellow="\e[0m\e[0;33m"
local reset="\e[0m"
local red="\e[0m\e[0;31m"
local yellow="\e[0m\e[0;33m"
echo -e "${red}
Error encountered in the following init script:
@ -18,23 +18,23 @@ ${red}
Aborting...
${reset}"
exit 77
exit 77
}
# Reset logs
for log in /var/log/maillog{,.{0..9}} /var/log/maillog.debug{,.{0..9}}
for log in /var/log/mail/maillog{,.{0..9}} /var/log/mail/maillog.debug{,.{0..9}} /var/log/mail/reject.log
do
if [ ! -f ${log} ]
then
touch ${log}
fi
if [ ! -f ${log} ]
then
touch ${log}
fi
done
syslogd -O /var/log/maillog -s 2000000 -b 10
syslogd -O /var/log/mail/maillog -s 2000000 -b 10
# Run all scripts in init folder
for file in /docker-entrypoint/init.d/*.sh
do
bash -c ${file} || die ${file}
bash -c ${file} || die ${file}
done
# Reload services
@ -43,4 +43,4 @@ postfix reload &&
echo -e "\n\e[1;32mMail service is ready\e[0m\n"
# Monitor log
tail -f /var/log/maillog{,.{0..9}} /var/log/maillog.debug{,.{0..9}}
tail -f /var/log/mail/maillog{,.{0..9}} /var/log/mail/maillog.debug{,.{0..9}}