Mail command to send email to 1 recipient is:
echo "email body" | mail -s "subject" ToEmail@example.com -- -r FromEmail@example.com
Mail command to send email to multiple recipients is:
echo "email body" | mail -s "subject" ToEmail@example.com,ToEmail2@example.com,ToEmail3@example.com -- -r FromEmail@example.com
You can also feed the email message using "<<<", which is useful for scripting:
mail -s "subject" ToEmail@example.com,ToEmail2@example.com,ToEmail3@example.com -- -r FromEmail@example.com <<< “mail body”
You can attach a file using the uuencode command. Make sure you put the file name twice:
uuencode test.txt test.txt | mail -s "subject" ToEmail@example.com,ToEmail2@example.com,ToEmail3@example.com -- -r FromEmail@example.com <<< “mail body”