Tuesday, 15 March 2011

php - Laravel sending separate, multiple mail without using foreach loop -



php - Laravel sending separate, multiple mail without using foreach loop -

i using mail function in laravel under swiftmailer library.

mail::send('mail', array('key' => $todos1), function($message) { $message->to(array('test@example.com','tessdt@example.com','tesjxfjt@example.com','tesfssdt@example.com'))->subject('welcome!'); });

the above function sends mail service several user, users know mail service sent address comprises of

to: test@example.com, tessdt@example.com, tesjxfjt@example.com, tesfssdt@example.com

so inorder rectify have used foreach loop sends mails seperatly

foreach($to $receipt){ //mail::queue('mail', array('key' => $todos1), function($message) utilize ($receipt) mail::send('mail', array('key' => $todos1), function($message) utilize ($receipt) { $message->to($receipt)->subject('welcome!'); }); }

the above code works fine...

my question in advanced framework is there function send mails users unique to address (i.e.) without 1 user knowing how-many others same mail service sent without using foreach...

you can utilize bcc (blind carbon copy):

mail::send('mail', array('key' => $todos1), function($message) { $message->to('firstemail@example.com') ->bcc(array('test@example.com','tessdt@example.com','tesjxfjt@example.com','tesfssdt@example.com')) ->subject('welcome!'); });

php email laravel laravel-4 swiftmailer

No comments:

Post a Comment