我的PHP代码需要帮助。所以我正在做的是一个建议框,所有建议都将发送到我的电子邮箱。我正在使用PHPmailer。但是,每当我尝试在盒子上发送建议时,我都不会发送到我的电子邮件,而是回应我为错误做的其他代码。我不确定我的代码有什么问题。
if (empty($errors)) {
$m = new PHPMailer;
$m->SMPTDebug =1;
$m->isSMTP();
$m->isSMTPAuth = true;
$m->Host = 'smpt.mail.yahoo.com';
$m->Username = 'blahblah@yahoo.com.sg';
$m->Password = 'blahbalh';
$m->SMTPSecure = 'tls';
$m->Port = '587';
$m->isHTML();
$m->Subject = 'Contact from submitted';
$m->Body = 'From: '.$fields['name'].' ('.$fields['email'].')<p>'.$fields['text'].'</p>';
$m->FromName = 'Contact';
$m->AddReplyTo($fields['email'], $fields['name']);
$m->AddAddress('blahblah@yahoo.com.sg', 'Bl Ah');
if ($m->send()) {
header('Location: trial_contact_thankyou.php');
die();
}
else {
$errors[] = 'Sorry, could not send email. Please try again later';
}
感谢有帮助的人!