Rizwan Saleem Rizwan Saleem - 2 years ago 114
PHP Question

Queue email receiver email address issue laravel 4.2

I am working in laravel 4.2 version and sending email for marketing purpose. But the problem is that when i send email to many users then all the users can view the email addresses of other users.
I am sending email using laravel queue method and here is my working code

$emails[] = 'someonea@gmail.com';
$emails[] = 'someoneb@gmail.com';
$emails[] = 'someonec@gmail.com';
$emails[] = 'someoned@gmail.com';
$emails[] = 'someonee@gmail.com';
if(!empty($emails)){
$data['content'] = $message;
$admin_email = UserHelper::$driver['admin_email'];
$site_title = UserHelper::$driver['site_title'];
Mail::queue('emails.market',$data,function($mail)use($emails,$subject,$data){
$mail->to($emails);
$mail->subject($subject);
$mail->from($emails);
});
}


when i receive an email then i am also able to see the email all other users in to of inbox.
Please help to resolve this issue.
Thanks in advance

Answer Source

You can try bcc to send the same email to other users. When you use BCC, any recipients on the Bcc line of an email are not visible to others on the email.

Mail::queue('emails.market',$data,function($mail)use($emails,$subject,$data){
    $mail->to($firstEmailAddredd);
    $mail->to($restAllEmailAddredd);
    $mail->subject($subject);
    $mail->from($emails);
  });

Not tested this thing, but sure that this will help you!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download