Php SMTP服务器响应:451
我已经构建了两个联系人表单(quote.php和contact.php),使用jquery进行验证,并提交给单独的ajax_contact.php和ajax_quote.php文件。它们都是基于我在其他网站上使用的相同模板构建的,但出于某种原因,ajax_contact.php返回以下错误:Php SMTP服务器响应:451,php,ajax,email,forms,smtp,Php,Ajax,Email,Forms,Smtp,我已经构建了两个联系人表单(quote.php和contact.php),使用jquery进行验证,并提交给单独的ajax_contact.php和ajax_quote.php文件。它们都是基于我在其他网站上使用的相同模板构建的,但出于某种原因,ajax_contact.php返回以下错误: Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html.
Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\Hosting\5219056\html\ajax_contact.php on line 41
我收到的是自动回复邮件,但不是包含表单中提交的数据的邮件
我真的对此束手无策。我一整天都在试图用“\r\n”和“\n”来修复它,我原以为会根据错误来修复它,但我仍然在同一条船上
以下是ajax_contact.php:
<?php
// where is your config file stored?
include ("ajaxSubmit.php");
// CLIENT INFORMATION
$Firstname =3D $HTTP_POST_VARS['Firstname'];
$Lastname =3D $HTTP_POST_VARS['Lastname'];
$email =3D $HTTP_POST_VARS['email'];
$Business =3D $HTTP_POST_VARS['Business'];
$Address =3D $HTTP_POST_VARS['Address'];
$City =3D $HTTP_POST_VARS['City'];
$State =3D $HTTP_POST_VARS['State'];
$Zip =3D $HTTP_POST_VARS['Zip'];
$Phone =3D $HTTP_POST_VARS['Phone'];
$Fax =3D $HTTP_POST_VARS['Fax'];
$Comments =3D $HTTP_POST_VARS['Comments'];
// MODIFY THE FOLLOWING SECTION
// your name
$recipientname =3D "Company";
// your email
$recipientemail =3D "me@email.com";
// subject of the email sent to you
$subject =3D "Feedback for $recipientname";
// send an autoresponse to the user?
$autoresponse =3D "yes";
// subject of autoresponse
$autosubject =3D "Thank you for your mail!";
// autoresponse message
$automessage =3D "Thanks for the message.";
// thankyou displayed after the user clicks "submit"
$thanks =3D "Thank you for contacting us. We will get back to you as soon =
as possible.";
// END OF NECESSARY MODIFICATIONS
// format message
$message =3D "Online-Form Response for $recipientname:
<br>
Firstname: $Firstname
<br>
Lastname: $Lastname
<br>
Email: $email
<br>
Business: $Business
<br>
Address: $Address
<br>
City: $City
<br>
State: $State
<br>
Zip: $Zip
<br>
Phone: $Phone
<br>
Fax: $Fax
<br>
Comments: $Comments
<br>
";
// To send HTML mail, the Content-type header must be set
$headers =3D "MIME-Version: 1.0" . "\r\n";
$headers .=3D "Content-type: text/html; charset=3Diso-8859-1" . "\r\n";
// Additional headers
$headers .=3D "From: Company <info@company.com>" . "=
\r\n";
$headers .=3D "Bcc: admin@email.com" . "\r\n";
// send mail and print success message
mail($recipientemail, $subject, $message, $headers);
echo "<script language=3D\"JavaScript\" type=3D\"text/JavaScript\"> windo=
w.location.href =3D \"thanks_feedback.php\";</script>";
?
不仅在标题中使用,而且在正文中使用\r\n。
由于您使用文件中的换行符,您可以在您使用的代码编辑器中进行设置。代码中的所有这些3D
是什么?刚好在$variable之后=
$recipientname =3D "Company";
刚刚看到你的编辑-想朝你的方向扔。它不使用PHP mail()函数,但如果您在当前设置中使用mail()函数编写了所有内容,则只需做一些小的更改
看一看,如果你有任何问题,请告诉我
(完全披露:我是PostageApp的产品经理!)如果不使用任何自定义标题,它是否有效?我尝试过,但可能做得不对。LF应该在正文消息中的每一个换行符之后吗?从服务器对您的回答来看,您需要使用另一个换行符,而不仅仅是LF。试试看\r\n我不知道。我已经有一段时间没问这个了。我甚至不记得我在做什么-/嘿,是的,这是一条很老的线。出于某种原因,它突然出现在头版。无论你在做什么,我想这都是问题所在:-)
<?php
/* VALIDATE HOW YOU NEED TO VALIDATE */
require_once('recaptchalib.php');
$privatekey = "******************************";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
$isValidate = true; // RETURN TRUE FROM VALIDATING, NO ERROR DETECTED
/* RETTURN ARRAY FROM YOUR VALIDATION */
/* THIS NEED TO BE IN YOUR FILE NO MATTERS WHAT */
if($isValidate == true){
echo "";
}else{
echo '{"jsonValidateReturn":'.json_encode($arrayError).'}'; // RETURN ARRAY WITH ERROR
}
?
$recipientname =3D "Company";