PHPMailer错误
大家好,我一直收到这个错误,不知道如何修复它 {“响应”:“错误”,“消息”:“您必须至少提供一个收件人。” 电子邮件地址。“} 这是代码PHPMailer错误,php,mailer,Php,Mailer,大家好,我一直收到这个错误,不知道如何修复它 {“响应”:“错误”,“消息”:“您必须至少提供一个收件人。” 电子邮件地址。“} 这是代码 <?php require_once('phpmailer/class.phpmailer.php'); $mail = new PHPMailer(); //recipient data $toemail = $_POST['contact@spadaweb.com']; // Your Email Address $toname = $_PO
<?php
require_once('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
//recipient data
$toemail = $_POST['contact@spadaweb.com']; // Your Email Address
$toname = $_POST['Spadaweb, INC']; // Your Name
//sender data
$name = $_POST['contact-form-name'];
$email = $_POST['contact-form-email'];
$service = $_POST['contact-form-service'];
$subject = $_POST['contact-form-subject'];
$message = $_POST['contact-form-message'];
if( isset( $_POST['contact-form-submit'] ) ) {
if( $name != '' AND $email != '' AND $subject != '' AND $message != '' ) {
$body = "Name: $name <br><br>Email: $email <br><br>Service: $service <br> <br>Message: $message";
$mail->SetFrom( $email , $name );
$mail->AddReplyTo( $email , $name );
$mail->AddAddress( $toemail , $toname );
$mail->Subject = $subject;
$mail->MsgHTML( $body );
$sendEmail = $mail->Send();
if( $sendEmail == true ):
$arrResult = array ('response'=>'success');
else:
$arrResult = array ('response'=>'error','message'=>$mail->ErrorInfo);
endif;
} else {
$arrResult = array ('response'=>'empty');
}
} else {
$arrResult = array ('response'=>'unexpected');
}
echo json_encode($arrResult);
?>
我已将电子邮件等更改为我的,我一直收到上述错误?目前也托管在bluehost vps cent os服务器上。是否在此特定帐户上启用DKIM?谢谢你检查这个问题
$toemail = $_POST['contact@spadaweb.com']; // Your Email Address
$toname = $_POST['Spadaweb, INC']; // Your Name
这需要改变,因为你给了它实际的变量,而不是试图得到文章
$toemail = 'contact@spadaweb.com'; // Your Email Address
$toname = 'Spadaweb, INC'; // Your Name
现在它应该可以发送了。
$toemail=$\u POST['contact@spadaweb.com']
-这是输入字段的名称吗?这是用表单中名为contact@spadaweb.com
。尝试将其硬连接到$toemail=contact@spadaweb.com“
看看这是否会有所不同非常感谢,我有一种感觉,这将是非常简单的事情!