Warning: mail (): SMTP Server Response: 530 5.7.0 You must first run a STARTTLS command

advertisements

This question already has an answer here:

  • SMTP server response: 530 5.7.0 Must issue a STARTTLS command first 9 answers

Details

  • I am running a PHP script on my local Windows 7 machine using php.exe
  • I want to trigger an email at the end of my script, but I couldn't get it to send an email.

Mail

mail('[email protected]', '$title' , '$data' );

This is what I've in my php.ini

[mail function]

SMTP = smtp.gmail.com
smtp_port = 25
username = [email protected]
password = *****
sendmail_from = [email protected]

I still can't send out any mail. I keep getting :

Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. l49sm2288391qgd.21 - gsmtp

Please kindly advise - if I did anything wrong.

Feel free to give me any suggestions.

Thank-you for your time !


mail() is one of those PHP functions that should have never become part of PHP code, because it's simply poorly implemented and very plain. It just does not support TLS so use PHPMailer or similar package instead