Sending an email using Curl

Here is an example of how to send an email using curl on a Unix shell:

echo "To: <>;<>;<>;<>;
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?.

" | curl -s --ssl-reqd smtp:// --mail-from '' --mail-rcpt '' --upload-file /dev/stdin

And here from a bash script:

echo -e "To:\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:// --mail-from '' --mail-rcpt '' -n -T - 

Leave a Reply

Your email address will not be published. Required fields are marked *