user2164884
user2164884

Reputation:

sending email to multiple recipients not see other users addresses

hello friend me sending registered users activation link and code on their email address via admin panel and it working fine users can get acivtation link and code.

but problem is that users can see other recipients email address In To: i want users cannot see others recipients email address?

here my code

<?php 
//creating activation code
$alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$length = 11;
for($i=0; $i<$length; $i++){
$ran = rand(0, strlen($alpha)-1);
$new_key .= substr($alpha, $ran, 1);
}   


$activation = 'activation.php?email='.urlencode($_POST['email1']).'&key='.$new_key;
$your_email = '[email protected]'; 
$domain = $_SERVER["HTTP_HOST"];
$to = implode(',', $_POST['email1']);
$subject = 'Confirmation';
$message = '<font class="font1">
<a href="http://'.$domain.'/'.$activation.'">http://'.$domain.'/'.$activation.'</a></font>';

$headers .= 'MIME-Version: 1.0' . "\r\n";  
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";  
$headers .= "From: <$your_email>\r\n" .  
"X-Mailer: PHP/" . phpversion(); 

mail($to, $subject, $message, $headers);
?>

form where selecting users email address

<form name ="checkForm" id="checkForm" method="post">  
<?php 
$query=mysql_query("select semail from students order by id") 
or die ('students query');

while($row=mysql_fetch_array($query))
{
?>

<input type="text" name="email1[]" value="<?php echo $row['semail'] ?>"  />

<?php } ?> 

</form>

Upvotes: 0

Views: 263

Answers (1)

Shafeeque
Shafeeque

Reputation: 2069

Use BCC

$headers .= 'From: Your Name <[email protected]' . "\r\n";
$headers .= 'BCC: '.  implode(',', $_POST['email1']) . "\r\n";

mail(null, $title, $content, $headers);

Upvotes: 1

Related Questions