所以,我正在嘗試做一件非常簡單的事情 - 使用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