0
大家好我一直得到這個錯誤,不知道如何解決它。錯誤與PHPMailer
{ 「迴應」: 「錯誤」, 「消息」: 「您必須提供至少一個收件人 電子郵件地址」}
這是代碼。
<?php
require_once('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
//recipient data
$toemail = $_POST['[email protected]']; // 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 ['[email protected]']' - 是您的輸入字段的名稱?這就是填充你的表單中名爲'contact @ spadaweb.com'的一個字段的內容。嘗試將它硬連線到'$ toemail ='contact @ spadaweb.com'',看看這是否有所作爲 – andrewsi