lundi 14 mars 2016

Laravel 5 unique bulk mailing

I have an app that sends a unique link to over 1000 email addresses every time a button is clicked.

I'm currently queueing the mail but the app still takes about 15+ seconds to respond. Database and redis queuing seem to both take long.

Each email must have a unique link created in the controller and inserted into the blade template.

What is the best way to speed up the response time?

Thank you :)

sample code:

...

  foreach ($members as $key => $member) {


    $data = [
    'unique_link'=>base64_encode($member->id.','.$group_id),
    'email'=>$member->email,
    'subject'=>$group->title,
    'member'=>$member];

    Mail::queue(['emails.group', 'emails.txt'], $data, function ($message) use ($data){
    $message->from('admin@example.com', 'Example Name');
    $message->subject('Example Subject - '. $data['subject']);
    $message->to($data['email']);
        });

    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire