Sunday, March 11, 2018

Sending multiple unique emails at once in laravel (mailtrap.io) - development

Sending multiple unique emails at once in laravel (mailtrap.io)

I have an email array with the variables email and signup_token. I want to send the signup_token to the corresponding email in that array. How can I send multiple emails at once with unique content from an array in Laravel. I am using mailtrap. The array will be big, maybe up to 20-25 arrays in it (with emails and unique signup tokens). As I do it with foreach it goes really slow. Thanks in advanced.

       foreach(request('email_list') as $email) {
            array_push($emailList, [
                'email' => $email,
                'signup_token' => md5($email)
            ]);
            Mail::to($email)->send(new RegisterStudent(md5($email)));
        }



from Laravel Questions and Answers https://laravelquestions.com/php/sending-multiple-unique-emails-at-once-in-laravel-mailtrap-io/
via Lzo Media

No comments:

Post a Comment