[英]How to make a contact form send a confirmation email to the user?
這是我到目前為止所擁有的..
$full_name = $_REQUEST['full_name'] ;
$company = $_REQUEST['company'] ;
$abn = $_REQUEST['abn'] ;
$customer_number = $_REQUEST['customer_number'] ;
$about = $_REQUEST['about'] ;
$areacode = $_REQUEST['areacode'] ;
$telephone = $_REQUEST['telephone'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$body =" Full Name: ".$full_name."\n
Company: ".$company."\n
ABN: ".$abn."\n
Customer Number: ".$customer_number."\n
About: ".$about."\n
Area Code: ".$areacode."\n
Telephone: ".$telephone."\n
Email: ".$email."\n
Message: ".$message;
$to = "$email";
mail( "info@rentforbusiness.com.au", "Contact Us Form", $body, "From: $email" );
就像您為自己做的一樣。
mail($email, "Thanks For Resistering", $a_thank_you_message, "From: info@rentforbusiness.com.au" );
在數據庫中創建一個表。 它應包含以下字段:
用戶發布表單時,請勿將郵件發送到您的電子郵件中,而是需要創建隨機確認代碼(例如,使用uniqid ):
$confirmation = uniqid();
然后將用戶電子郵件,消息文本和確認代碼添加到表中並將電子郵件發送給用戶:
$url = "http://".$_POST["SERVER_NAME"].
"/confirmation.php?confirmation=$confirmation'>";
mail($email, "Confirmation",
"Please press the following link to confirm your message:
<a href='http://$url'>confirm</a>.");
在confirmation.php
文件中,使用$_GET["confirmation"]
變量,在表中搜索匹配的記錄,從中獲取電子郵件和消息,然后將此數據發送到您的電子郵件中。 您可以根據需要從數據庫中刪除條目。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.