I am trying to automate my email by using this command on unix VI:
echo 'Message body goes here' | mail -s 'subject line goes here' email@example.com
mailx is usually link with mail.
Try passing the options to sendmail by putting double-dash at the end and then specifying -f (from) or -r (return):
mailx .... -- -r firstname.lastname@example.org mailx .... -- -f email@example.com
You could also try "-a" option as mentioned here
mailx -a 'From:firstname.lastname@example.org' ...
If you want to try the sendmail:
sendmail -t <<EOF To: email@example.com Subject: Hi From: firstname.lastname@example.org Reply-To: email@example.com Hello EOF