简体   繁体   English

php mail函数错误 - >警告:mail()[function.mail]:SMTP服务器响应:530 5.7.0必须先发出STARTTLS命令

[英]php mail function error -> Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first

I am trying to send email from php to a gmail account. 我正在尝试从php发送电子邮件到Gmail帐户。 I have the following settings on my laptop: 我的笔记本电脑上有以下设置:

  1. Windows 8 Windows 8
  2. Internet connection 网络连接
  3. XAMPP 1.7.4, PHP Version 5.3.5, XAMPP 1.7.4,PHP版本5.3.5,

I have the following php.ini settings 我有以下php.ini设置

[mail function] ; [邮件功能]; For Win32 only. 仅适用于Win32。 ; ; http://php.net/smtp SMTP = smtp.gmail.com ; http://php.net/smtp SMTP = smtp.gmail.com; http://php.net/smtp-port http://php.net/smtp-port

smtp_port = :465 smtp_port =:465

; ; For Win32 only. 仅适用于Win32。 ; ; http://php.net/sendmail-from ;sendmail_from = postmaster@localhost http://php.net/sendmail-from ; sendmail_from = postmaster @ localhost

; ; For Unix only. 仅适用于Unix。 You may supply arguments as well (default: "sendmail -t -i"). 您也可以提供参数(默认值:“sendmail -t -i”)。 ; ; http://php.net/sendmail-path ;sendmail_path = "\\"C:\\xampp\\sendmail\\sendmail.exe\\" -t" http://php.net/sendmail-path ; sendmail_path =“\\”C:\\ xampp \\ sendmail \\ sendmail.exe \\“ - t”

The following is the php code: 以下是php代码:

<?php

$to = 'goodmandiamont@gmail.com';
$subject = 'hi';
$msg = 'Test';
$headers = 'From: postmaster@localhost' ."\r\n" .
            'Reply-To: shawn.danisa@gmail.com' . "\r\n" .
            'X-Mailer: PHP /' . phpversion();
mail($to, $subject,$msg,$headers);

?>

I get the following error: 我收到以下错误:

Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. 警告:mail()[function.mail]:SMTP服务器响应:530 5.7.0必须先发出STARTTLS命令。

I also made sure the IMAP setting is enabled on the gmail settings. 我还确保在gmail设置上启用了IMAP设置。 I also checked to see If I will find the following lines on the php.ini file: 我还检查了如果我将在php.ini文件中找到以下行:

ini_set("SMTP","ssl://smtp.gmail.com"); 的ini_set( “SMTP”, “SSL://smtp.gmail.com”);

ini_set("smtp_port","465"); 的ini_set( “SMTP_PORT”, “465”);

But no luck, I just cant find them anywhere. 但没有运气,我只是无法在任何地方找到它们。 Please assist, I am new to php. 请协助,我是php的新手。

Initially, you make sure your PHP installation has SSL support (look for an "openssl" section in the output from phpinfo() ). 最初,确保您的PHP安装具有SSL支持(在phpinfo()的输出中查找“openssl”部分)。

Again you need to set the following settings in your PHP configuration PHP.ini 您需要在PHP配置PHP.ini中设置以下设置

ini_set("SMTP","ssl://smtp.gmail.com");
ini_set("smtp_port","465");

Hope this solves your problem. 希望这能解决你的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WampServer:警告:mail():SMTP 服务器响应:530 5.7.0 必须先发出 STARTTLS 命令 - WampServer: Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first SMTP 错误:MAIL FROM 命令失败:530 5.7.0 使用 PHPMailer 时必须先发出 STARTTLS 命令 - SMTP ERROR: MAIL FROM command failed: 530 5.7.0 Must issue a STARTTLS command first when using PHPMailer 如何解决此错误( mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. i2sm7399406pjt.19 - gsmtp ) - How solve this error ( mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. i2sm7399406pjt.19 - gsmtp ) 警告:mail()[function.mail]:SMTP服务器响应:552 5.7.0 DATA标头大小超过允许的最大值 - Warning: mail() [function.mail]: SMTP server response: 552 5.7.0 DATA header size exceeds maximum permitted SMTP 服务器响应:530 5.7.0 必须先发出 STARTTLS 命令 - SMTP server response: 530 5.7.0 Must issue a STARTTLS command first PHPMailer:不接受来自服务器的MAIL:530 5.7.0必须首先发出STARTTLS命令 - PHPMailer : MAIL not accepted from server: 530 5.7.0 Must issue a STARTTLS command first 警告:mail()[function.mail]:SMTP服务器响应:550 - Warning: mail() [function.mail]: SMTP server response: 550 警告:mail()[function.mail]:SMTP服务器响应:554 - Warning: mail() [function.mail]: SMTP server response: 554 SMTP 服务器响应:530 5.7.0 必须首先发出 STARTTLS 命令。 Windows 7的 - SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. windows 7 SMTP-&gt;错误:服务器未接受AUTH:530 5.7.0必须首先发出STARTTLS命令 - SMTP -> ERROR: AUTH not accepted from server: 530 5.7.0 Must issue a STARTTLS command first
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM