所以,我正在尝试做一件非常简单的事情 - 使用PHP发送电子邮件。我查看了堆栈上的其他查询,并没有涉及条件语句,所以我想检查一下,看看我能否得到一些快速的建议。请参阅下面的条件,然后将确认/感谢电子邮件发送给捐赠给我的组织的人。在条件语句后使用PHP发送电子邮件
难道是我首先让代码回显/打印语句,然后运行mail()函数?
if ((isset($_POST['submitted'])) && ($ack!="SUCCESS")) {
$_SESSION['reshash']=$resArray;
$location = "https://globalcitizenyear.org/wp-content/themes/deMar/APIError.php";
header("Location: $location");
} elseif ($ack =="SUCCESS") {
echo ("<h2>Thank You</h2><p>Thank you for your generous donation of $$amount. You will receive an email confirmation with an attached tax receipt.</p>");
$body = "Dear $firstName,
/n/nThank you ...
/n/nAs I travel the country, ...
/n/nPlease accept my deepest gratitude for your contribution.
/n/nSincerely,
/n/nAbigail Falik
/n/nFounder and CEO
/nGlobal Citizen Year";
**$body = wordwrap($body,70);
mail("$email",'Thank you for your donation to Global Citizen Year (Important tax receipt)', $body,"From:[email protected]");**
}
else {
// Display Form ?>
你想完成什么?我没有看到这个问题。 – Moshe 2011-03-11 19:27:31
'/ n'应该是'\ n' – drudge 2011-03-11 19:29:59
即使这样,它们也不是必需的 - 你在字符串中有换行符开头! – Charles 2011-03-11 19:34:19