SMTP server response: 530 5.7.0 Must issue a START

2020-01-25 09:26发布

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

标签: php smtp
9条回答
我命由我不由天
2楼-- · 2020-01-25 10:01

Problem Solved,

I edited the file /etc/postfix/master.cf

and commented

-o smtpd_relay_restrictions=permit_sasl_authenticated,reject

and changed the line from

-o smtpd_tls_security_level=encrypt 

to

-o smtpd_tls_security_level=may

And worked on fine

查看更多
Anthone
3楼-- · 2020-01-25 10:02

I know that PHPMailer library can handle that kind of SMTP transactions.

Also, a fake sendmail with sendmail-SSL library should do the job.

查看更多
叛逆
4楼-- · 2020-01-25 10:02

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:

smtp.gmail.com
Port: 587
查看更多
Summer. ? 凉城
5楼-- · 2020-01-25 10:09

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

查看更多
爱情/是我丢掉的垃圾
6楼-- · 2020-01-25 10:09

I had a false response for the following:

fputs($connection, 'STARTTLS'.$newLine);

turns out I use the wrong connection variable, so I just had to change it to:

fputs($smtpConnect, 'STARTTLS'.$newLine);

If using TLS remember to put HELO before and after:

fputs($smtpConnect, 'HELO '.$localhost . $newLine);
$response = fgets($smtpConnect, 515);
if($secure == 'tls')
{
    fputs($smtpConnect, 'STARTTLS'.$newLine);
    $response = fgets($smtpConnect, 515);
stream_socket_enable_crypto($smtpConnect, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);

// Say hello again!
    fputs($smtpConnect, 'HELO '.$localhost . $newLine);
    $response = fgets($smtpConnect, 515);
}
查看更多
乱世女痞
7楼-- · 2020-01-25 10:10

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

查看更多
登录 后发表回答