0
我在我的網站上使用電子郵件表格。我希望發送的郵件包含用戶輸入的郵件地址或標題爲「<a href="mailto:ENTERED_EMAIL?subject=re\:ENTERED_SUBJECT">
」的html鏈接的標題中的「回覆」項。我想這樣做,所以檢查郵件的員工可以用我們的郵件客戶端來回答,而無需手動輸入地址。 不幸的是我不明白它的工作原理。這是我工作的客戶端,而不鏈接/回覆:如何在通過電子郵件形式發送的電子郵件中創建回覆鏈接?
$destination = '[email protected]';
$sender = '[email protected]';
$sendername = 'myhomepage.de';
$subject = 'Mitteilung des E-Mail Formulars';
$urlsuccesspage = 'http://myhomepage.de/kontakt.php#success';
$separator = ":\t"; // colon and tabulator
if ($_SERVER['REQUEST_METHOD'] === "POST") {
$header = array();
$header[] = "From: ".mb_encode_mimeheader($sendername, "utf-8", "Q")."<".$sender.">";
$header[] = "MIME-Version: 1.0";
$header[] = "Content-type: text/plain; charset=utf-8";
$header[] = "Content-transfer-encoding: 8bit";
$mailtext = "";
foreach ($_POST as $name => $value) {
if (is_array($value)) {
foreach ($value as $singlevalue) {
$mailtext .= $name.$separator.$value. "\n";
}
} else {
$mailtext .= $name.$separator.$value. "\n";
}
}
mail(
$destination,
mb_encode_mimeheader($subject, "utf-8", "Q"),
$mailtext,
implode("\n", $header)
) or die("Die Mail konnte nicht gesendet werden.");
header("Location: $urlsuccesspage");
exit;
}
header("Content-type: text/html; charset=utf-8");
這些是我想要整合的值:
<input class="fieldvalue" type="text" name="Email" />
<select class="fieldvalue" name="Subject">
<option value="Frage">Frage</option>
<option value="Feedback">Feedback</option>
<option value="technisch">technische Frage</option>
<option value="Sonstige">Sonstige</option>
</select>
查看手冊http://php.net/manual/en/function.mail.php''Reply-To:'。 $ from,' –
@ Fred-ii- 我已經嘗試添加'$ header [] =「Reply-To:」。$ _ POST ['Email'];'但它根本不發送郵件。 – FeuerlordOhsai
'$ from = $ _POST ['Email'];'---''Reply-To:'。從$' –