2012-03-02 56 views
0

我正在使用Joomla 1.6平臺的自定義表單。用戶的電子郵件沒有問題,但通知我們註冊的電子郵件沒有通過。是否有可能像這樣發回2封電子郵件,或者在我的代碼中是否有錯誤?用戶註冊發送2封電子郵件

///----------------User Email After Registered----------------------------/// 
// Send notification email // 


$to = $email; 
$subject = "$hs2 Alumni Football Team"; 
$message = " 
<html> 
<head></head> 
<body> 
<h1>Alumni Football USA</h1> 
<p> Hi $firstname,</p> 
<p>You are now able to sign up for $hs2 games! Login to Reserve your spot!</p> 
<p>Username: $username</p> 
<p>Password: $showpass</p> 
<p>$hs2 Alumni Football Team Page---$remail2 </p> 
<p>This is an automatic Email, please do not respond/reply</p> 
</body> 
</html> 
"; 
$headers .= "MIME-Version: 1.0\r\n"; 
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; 

$headers .= 'From: Alumni Football USA<[email protected]>' . "\r\n"; 


// Send notification // 
mail($to,$subject, $message, $headers); 

///---------------Email site owner-----------------------------------------/// 



$phone1 = $cell; 

$cell1 = formatPhone1($phone1); 

$phone2 = $home; 

$home1 = formatPhone2($phone2); 


$query = "SELECT t_name FROM " . $table_prefix . "bl_teams WHERE id = ".$team_id; 
    $db->setQuery($query); 
    $hs2 = $db->loadResult(); 


$query = "SELECT ((date_format(now(),'%Y') - date_format(birthday,'%Y')) - (date_format(now(),'00-%m-%d') < date_format(birthday,'00-%m-%d'))) 
    FROM " . $table_prefix . "users WHERE'".$email."' = username"; 
    $db->setQuery($query); 
    $age45 = $db->loadResult(); 



$query = "SELECT t_city FROM " . $table_prefix . "bl_teams WHERE ".$team_id."= id ";  
      $db->setQuery($query); 
    $city5 = $db->loadResult(); 


$query = "SELECT s.s_descr FROM " . $table_prefix . "bl_seasons as s WHERE ".$s_id."= s.s_id ";   
      $db->setQuery($query); 
    $state = $db->loadResult(); 




$query = "SELECT u.email FROM " . $table_prefix . "users as u, " . $table_prefix . "bl_teamcord as tc WHERE tc.s_id = ".$s_id." AND FIND_IN_SET('$team_id',tc.teams) AND tc.u_id = u.id AND 

tc.reg_emails = 1";   
      $db->setQuery($query); 
    $remail1 = $db->loadResultArray(); 


if ($remail1){ 
$remail = implode(",",$remail1); 
}else{ 
$remail = "";} 

// Send notification email // 

$to = $remail; 
$subject = "***Reserved***$hs2,$state --$firstname $lastname"; 
$message = " 
<html> 
<head><title>Alumni Football USA</title></head> 
<body> 
<h1>$firstname $lastname</h1> 
</body> 
</html> 
"; 
$headers .= "MIME-Version: 1.0\r\n"; 
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; 
$headers .= 'From: Alumni Football USA <[email protected]>' . "\r\n"; 


// Send notification // 
mail($to,$subject, $message, $headers); 


///--------------------------------------------------------------/// 
+0

不應該有任何問題至於發送回來,我一直在做。代碼中可能有些問題 – Henesnarfel 2012-03-02 02:35:31

+0

你確定'to'設置正確嗎?你確定在到達第二個「郵件」之前的代碼中沒有錯誤嗎? – 2012-03-02 03:30:13

+0

我會再次檢查,我一直在測試這半天。會建議。 – user1232073 2012-03-02 03:34:57

回答

0

的問題可能是你$變量可能沒有電子郵件值:

 

if ($remail1){ 
    $remail = implode(",",$remail1); 
} 
else{ 
    $remail = ""; //you might have this 
} 
$to = $remail; //so if $remail is blank so will be the $to as well 
 

所以確保您的$變量保存電子郵件,

 

if(!empty($to)) { 
    //send email 
    mail($to,$subject, $message, $headers); 
} 
 
相關問題