简体   繁体   English

WampServer:警告:mail():SMTP 服务器响应:530 5.7.0 必须先发出 STARTTLS 命令

[英]WampServer: Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first

I am having an issue with WampServer, I tried creating a contact form but it isn't working.我在使用 WampServer 时遇到问题,我尝试创建一个联系表单,但它不起作用。 BIOS stopped recognizing my 2GB RAM chip so my system thinks it's 32-bit instead of 64-bit. BIOS 停止识别我的 2GB RAM 芯片,所以我的系统认为它是 32 位而不是 64 位。 Here's the PHP error table:这是 PHP 错误表:

( ! ) Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. 8sm9902426ioe.8 - gsmtp in C:\Users\miner\Desktop\Configuration Creator\www\contact\mail.php on line 10
Call Stack
#   Time    Memory  Function    Location
1   0.0004  245672  {main}( )   ..\mail.php:0
2   0.0004  246648  mail ( )    ..\mail.php:10

Here's my code:这是我的代码:

contact.html联系人.html

<form action="mail.php" method="POST">
    <input type="text" class="form-control" name="name" placeholder="Name">
    <div class="padded-bottom"></div>
    <input type="text" class="form-control" name="email" placeholder="Email">
    <div class="padded-bottom"></div>
    <input type="text" class="form-control" name="subject" placeholder="Subject">
    <div class="padded-bottom"></div>
    <textarea type="text" class="form-control no-resize paragraph" rows="8" name="message" placeholder="Message"></textarea>
    <div class="padded-bottom"></div>
    <button type="submit" class="btn btn-default">Submit</button> <button type="reset" class="btn btn-default">Clear Form</button>
</form>

mail.php邮件.php

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$from = 'From: '. $name; 
$to = 'email@example.com'; 
$subject = $subject;
$body = "From: $name\n Email: $email\n Message:\n $message";     
if (mail ($to, $subject, $body, $from)) { 
    echo '<p>Your message has been sent!</p>';
} else { 
    echo '<p>Something went wrong. Please manually <a href="mailto:email@example.com">email me</a> and include a screenshot/copy of the log above.</p>'; 
}
?>

and finally, php.ini最后,php.ini

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = email@example.com

Sorry if it's a duplicate, my problem is different than others.抱歉,如果它是重复的,我的问题与其他问题不同。

Try to change this尝试改变这一点

; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587

to this (variant #1):对此(变体#1):

; http://php.net/smtp
SMTP = ssl://smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 465

or to this (variant #2):或对此(变体#2):

; http://php.net/smtp
SMTP = tls://smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587

One of my variants should be OK for you.我的一个变种应该适合你。

But I don't recommend use mail() function all the more so with Wamp (sockets will be good solution).但我不建议在 Wamp 中使用 mail() 函数(套接字将是很好的解决方案)。

UPDATE更新

Do you really use Gmail smtp-service with mail() or you post Gmail only for example?您真的将 Gmail smtp-service 与 mail() 一起使用,还是仅发布 Gmail? For using Gmail smtp-service you need authentication (password+username), but mail() function don't support it.要使用 Gmail smtp-service,您需要身份验证(密码+用户名),但 mail() 函数不支持它。 You need write personal mail-function based on sockets or use ready-made solutions like hMailServer and send mail using this software (hMailServer creditnails should be write to php.ini).您需要编写基于套接字的个人邮件功能或使用现成的解决方案,如 hMailServer 并使用此软件发送邮件(hMailServer creditnails 应写入 php.ini)。

暂无
暂无

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

相关问题 php mail函数错误 - &gt;警告: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 SMTP 服务器响应:530 5.7.0 必须先发出 STARTTLS 命令 - SMTP server response: 530 5.7.0 Must issue a STARTTLS command first SMTP 服务器响应:530 5.7.0 必须首先发出 STARTTLS 命令。 Windows 7的 - SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. windows 7 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 ) 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 PHPMailer:不接受来自服务器的MAIL:530 5.7.0必须首先发出STARTTLS命令 - PHPMailer : MAIL not accepted from server: 530 5.7.0 Must issue a STARTTLS command first 无法发送 AUTH LOGIN 命令。 错误:530 5.7.0 必须先发出 STARTTLS 命令 - Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first Symfony SwiftmailerBundle:Gmail 发送“530 5.7.0 必须先发出 STARTTLS 命令” - Symfony SwiftmailerBundle: Gmail sends “530 5.7.0 Must issue a STARTTLS command first” PHP SMTP 错误:SMTP 服务器响应:530 5.7.0 - PHP SMTP ERROR: SMTP server response: 530 5.7.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM