Here is an example of how to send an email using curl on a Unix shell:
echo "To: <email@example.com>;<email@example.com>;<email@example.com>;<email@example.com>;
Subject: Sending an Email with Curl!
Just wanted to check you were able to receive this email, sent over the curl command.
Has it gone into spam?.
Thanks.
" | curl -s --ssl-reqd smtp://example.com --mail-from 'example@example.com' --mail-rcpt 'example@example.com' --upload-file /dev/stdin
And here from a bash script:
echo -e "To: email@example.com\nSubject: Service is being restarted\n\nMaximum Service Check Attempts are reached!!!\nService is currently being restarted, this can take some time, wait until the next notification, before any action!" | /usr/bin/curl -s --ssl-reqd smtp://smtp.example.com --mail-from 'example@example.com' --mail-rcpt 'email@example.com' -n -T -