- Login to WHM
- Go to tweak settings
- Find “Prevent the user “nobody” from sending out mail to remote addresses (PHP and CGI scripts generally run as nobody if you are not using PHPSuexec and Suexec respectively.)”
- Turn it ON
- And save settings
After doing this, php wont send emails using mail function. If you have some script sending emails, then you can use smtp authentication which is safe way to send emails.