Gmail servers use SMTP Authentication under SSL or TLS. I think that there is no way to use the mail()
function under that circumstances, so you might want to check these alternatives:
They all support SMTP auth under SSL.
You’ll need to enable the php_openssl
extension in your php.ini.
Additional Resources:
- How to Send Email from a PHP Script Using SMTP Authentication (using
PEAR::Mail
) - Send email using PHP with Gmail (using phpMailer)
- Mailing using
Nette\Mail