【问题标题】:SMTP problem with PHP form in Godaddy hosting!Godaddy 主机中 PHP 表单的 SMTP 问题!
【发布时间】:2014-07-28 00:48:59
【问题描述】:

我正在通过 CSS Tricks 测试这个(很好的)simple form。在 Godaddy 托管的网站中。

我收到以下警告:

Warning: mail() [function.mail]: SMTP server response: 451 See

http://pobox.com/~djb/docs/smtplf.html 在 D:\Hosting\4923367\html\test\contactengine 在第 32 行。

(我检查了页面,但没有看到任何有用的信息)

contactengine.php

<?php

$EmailFrom = "chriscoyier@gmail.com";
$EmailTo = "janoochen@gmail.com";
$Subject = "Nice & Simple Contact Form by CSS-Tricks";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));

// validation
$validationOK=true;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>

有什么建议吗?

【问题讨论】:

  • 我的回答解决了您的问题吗?

标签: php smtp email


【解决方案1】:

This link 提供了一个解决方案。尝试用\r\n 替换你的换行符

在邮件消息的标题和内容中,新行应该由回车符 (CR) 和换行符 (LF) 来表示

【讨论】:

  • 是的,对不起,我完全忘记了这个哈。
猜你喜欢
  • 1970-01-01
  • 2016-08-18
  • 1970-01-01
  • 2019-09-18
  • 2019-09-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多