2012-03-02 12 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

+0

'to 'が正しく設定されていますか? 2番目の 'mail'に達する前にコードにエラーがないことは確かですか? –

+0

もう一度確認します。私はこの半日をテストしています。アドバイスします。 – user1232073

答えて

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); 
} 
 
関連する問題