#!/bin/bash # Script Name: sendmail_test.sh # Version: 02 # Description: This script sends a test email using sendmail. The recipient's email address is the first argument. # Check if an argument (email address) is provided if [ -z "$1" ]; then TO="root" else TO="$1" fi # Email details SUBJECT="Postfix Test" FROM="noreply@$(hostname)" BODY="This is the email body!" # Function to send email send_email() { if ! command -v sendmail &> /dev/null; then echo "Sendmail is not installed or configured. Please ensure sendmail is installed and properly set up." >&2 exit 1 fi sendmail -t <