To quickly test if the sendmail command is working correctly to then use it for example in shell scripts, via command line or even from PHP scripts (PHP supports sendmail to send emails from PHP scripts - you can set the sendmail path in your php.ini), you can issue the below command on your UNIX or Linux system:

# echo "Subject: sendmail test" | sendmail -v This email address is being protected from spambots. You need JavaScript enabled to view it.

This email address is being protected from spambots. You need JavaScript enabled to view it. is obviously the e-mail address you want the test email to be sent to. This sendmail command line example will send a blank email with the subject "sendmail test" to This email address is being protected from spambots. You need JavaScript enabled to view it. if the test is successful.

 

Source:
https://clients.javapipe.com/knowledgebase/132/How-to-Test-Sendmail-From-Command-Line-on-Linux.html