test msmtp

This commit is contained in:
2024-07-15 12:30:27 +02:00
parent a2efadf647
commit da761a9773
3 changed files with 42 additions and 2 deletions

View File

@@ -177,6 +177,17 @@ for (( i=0; i<$count; i++ )); do
done
# Mailversand
cat $mailtext | mail -s "$mailsubject" $email
check_ssmtp_packages() {
if ! dpkg -l | grep -q msmtp; then
echo "msmtp packages not installed. Installing..."
sudo apt-get update
sudo apt-get install -y msmtp
if [ $? -ne 0 ]; then
echo "Failed to install msmtp packages. Exiting..."
exit 1
fi
fi
}
echo -e "Subject: $mailsubject\n\n$mailtext" | msmtp -t email
exit 0