0
這是一個電子郵件發送後發送代碼顯示成功警報消息發送電子郵件
mail($ToID,$subject,$urltoemail,$headers);
後,用戶將被重定向
header("Location:".$_SERVER['SCRIPT_NAME']);
我必須表明的「郵件警報已發送成功「在重定向頁面。我怎麼能夠?
摘錄的代碼:
if(isset($_POST['submitbtn'])) {
$flag=true; $error="";
/*Getting Values**********************/
$ToID=$_POST['ToID'];
$fromID=$_POST['fromID'];
$subject=$_POST['subject'];
$URL=$_POST['URL'];
$message=$_POST['message'];
/*Validating the data*****************/
if(strlen($ToID)==0) {
$flag=false;
$error.="Enter To email address field";
} elseif(!preg_match_all("|^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$|U", $ToID, $arr)) {
$flag=false; $error.="Invalid To email address";
}
if($flag) {
$urltoemail = "<html><head><title>Forgot Password</title></head><body> <table><tr><td>".$message."</td></tr><tr><td><a href='{$URL}'>Click here for viewing map</a></td></tr></table></body></html>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
if(strlen($fromID)==0)
$fromID = '[email protected]';
$headers .= 'From: '.$fromID. "\r\n";
mail($ToID,$subject,$urltoemail,$headers);
//$_SESSION['m'] = "item successfully deleted";
header("Location:".$_SERVER['SCRIPT_NAME']);
}
}
我可以在哪裏寫這段代碼?沒有條件? – Ashitha 2011-06-10 09:31:17
你能展示更多的代碼嗎?一般來說這很難說。 – 2011-06-10 09:33:48
if(isset($ _ POST ['submitbtn'])) { \t $ flag = true; \t $ error =「」; \t/*正在獲取值**********************/ \t $ ToID = $ _ POST ['ToID']; \t $ fromID = $ _ POST ['fromID']; \t $ subject = $ _ POST ['subject']; \t $ URL = $ _ POST ['URL']; \t $ message = $ _ POST ['message']; \t/*驗證數據*****************/ \t如果(strlen的($ TOID)== 0) \t { \t \t $標誌=假; \t \t $ error。=「Enter To Email address field」; (!|^a_z0-9 - ] +(\。[_ a-z0-9 - ] +)* @ [a-z0-9 - ] +(\。 [a-z0-9 - ] +)*(\。[az] {2,3})$ | U「,$ ToID,$ arr)) \t { \t \t $ flag = false; \t \t $ error。=「郵件地址無效」; \t \t} – Ashitha 2011-06-10 09:36:56