U are not allowed to send unauthenticated emails from PHP directly using the localhost SMTP server, it will be blocked. Please use your own domain email server / gmail / hotmail to send out emails instead. Please use a SMTP server / email address / email password to code in the PHP to send out emails.

Send Email From a PHP Script Using SMTP Authentication