SMTP server response: 530 5.7.0 Must issue a STARTTLS command first
I get this error message when i use mail() function in php script file...
I m using gmail SMTP server and gmail using STARTTLS which is secure SSL and i already use these commands in my contact.php file
ini_set("SMTP","smtp.gmail.com");
ini_set("sendmail_from","<email-address>@gmail.com>");
so what command i can use to enable STARTTLS or configure in php,ini file??
In my case, Swift Mailer couldn't help either. I found a solution here: http://forum.powweb.com/showthread.php?t=73406 - so after EHLO command one needs to send STARTTLS command, enabling cryptography with
stream_socket_enable_crypto( $connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT );
and again EHLO command. Only this allowed me to send emails with my "stubborn" SMTP server.First, make sure you PHP installation has SSL support (look for an "openssl" section in the output from
phpinfo()
).You can set the following settings in your PHP.ini: