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??
Problem Solved,
I edited the file
/etc/postfix/master.cf
and commented
and changed the line from
to
And worked on fine
I know that PHPMailer library can handle that kind of SMTP transactions.
Also, a fake sendmail with sendmail-SSL library should do the job.
I am going to share my way and it worked for me after implementing following:
Open Php.ini file and fill the all the values in the respective fields by taking ref from Gmail SMTP Settings
Remove comments from the [mail function] Statements which are instructions to the smtp Server and Match their values.
Also the sendmail SMTP server is a Fake server. Its nothing beside a text terminal (Try writing anything on it. :P). It will use gmail s,tp to send Mails. So configure it correctly by matching Gmail SMTP settings:
Out of the box Swift Mailer can't do STARTTLS, however some nice guys have written a patch for it.
I found patching it was a bit of a chore (probably went about it the wrong way), so have zipped it up ready for download here: Swift Mailer with STARTTLS
I had a false response for the following:
turns out I use the wrong connection variable, so I just had to change it to:
If using TLS remember to put HELO before and after:
For Windows, I was able to get it working by enabling TLS for secure communication on the SMTP Virtual server. TLS will not be available on the SMTP virtual server without a certificate. This link will give the steps needed.
https://support.microsoft.com/en-ie/help/4014125/how-to-configure-iis-smtp-for-outgoing-tls-authentication