我熟悉用PHP提交表單並將其格式化爲電子郵件地址,但我有一位客戶說他們最後一個組織有表單提交集,因此傳入電子郵件被分類到特定文件夾。我不熟悉這個功能。將表單數據提交到電子郵件文件夾
我做了一個谷歌搜索廣告,沒有任何適用問題出現,所以我轉向了StackOverflow。
我有我使用的大多數客戶端形式的簡單腳本:
$redirectTo = "http://www.somedomain.com";
$to = "[email protected]";
$from = "Contact Form";
$subject = "Contact Form Submission";
$headers = "From: $from\r\n";
$message = "";
$formFields = array_keys($_POST);
for ($i = 0; $i < sizeof($formFields); $i++)
{
$theField = strip_tags($formFields[$i]);
$theValue = strip_tags($_POST[$theField]);
$message .= $theField;
$message .= " = ";
$message .= $theValue;
$message .= "\n";
}
$success = mail($to, $subject, $message, $headers);
if ($success)
{
header("Location: " . $redirectTo);
}
else
{
echo "An error occurred when sending the email.";
}
的思考?
排序電子郵件的「規則」是在電子郵件客戶端(Outlook,Gmail等) –
或郵件服務器(如交換)中完成的,但您可以設置自定義標頭以便於該客戶端\服務器。 – 2012-01-24 19:24:42