Email

Sending email from the command line

#!/bin/sh
 
# Send an email to a list of recipients
# Usage: send_email.sh <subject> <body> <recipients>
 
subject="$1"
body="$2"
recipients="$3"
 
echo "Subject: $subject"
echo "Body: $body"
echo "Recipients: $recipients"
 
echo "Sending email..."
 
# Send the email using the mail command
mail -s "$subject" "$recipients" <<< "$body"
 
echo "Email sent!"