Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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??

like image 425
Waqas Ghouri Avatar asked Mar 10 '11 20:03

Waqas Ghouri


People also ask

What is Starttls command in SMTP?

StartTLS is a protocol command used to inform the email server that the email client wants to upgrade from an insecure connection to a secure one using TLS or SSL. StartTLS is used with SMTP and IMAP, while POP3 uses the slightly different command for encryption, STLS.

How do you resolve the SMTP server requires a secure connection or the client was not authenticated the server response was 5.7 0 authentication required Learn more at?

Use smtp.gmail.com instead of smtp.google.com. Use port 587. Set client. UseDefaultCredentials = false; before setting credentials.


1 Answers

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:

ini_set("SMTP","ssl://smtp.gmail.com"); ini_set("smtp_port","465"); 
like image 73
chuckx Avatar answered Oct 15 '22 04:10

chuckx