Nosean
1 year ago

Send Mail Action "Maximum execution time of 30 seconds exceeded"

Posted 1 year ago by Nosean

Hey ,

i have a problem with send Mail incl. Attachment

public function actionsendremember (Request $request) {

        $date = $request->lieferdatum;
        $today  = Carbon::createFromFormat('d.m.Y', $request->lieferdatum);
        $yesterday = date_format($today->subDay(), 'd.m.Y');

        foreach($request->user_id as $kto) {

            $users = DB::table('users')
                    ->where('Kto', '=', $kto)
                    ->first();

                    $data = Array(
                        'date' => $date,
                        'yesterday' => $yesterday,
                        'user_name' => $users->Name,
                        'user_name2' => $users->Name2,
                        'user_adress' => $users->LieferStrasse,
                        'user_zip' => $users->LieferPLZ,
                        'user_city' => $users->LieferOrt,
                        'user_email' => $users->EMail,
                        'user_kto' => $users->Kto
                        );

                    // Erstelle PDF


                    $pdf = PDF::loadView('orderform', ['data' => $data])
                                ->setPaper('a4', 'landscape');


                    // Email senden
                    Mail::send('admin.remember', ['data' => $data, 'pdf' => $pdf],  function ($message) use ($data, $pdf)
                    {
                        $message->from('[email protected]', 'Propan-Fischer Team');
                        $message->to($data['user_email']);
                        $message->subject("Propan-Fischer Bestellerinnerung");
                        $message->attach($pdf->download('orderform.pdf'));
                    });
        }

        Session::flash('message', 'Alle Bestellerinnerungen wurden versendet');
        return back();

    }

I become a Error Message:

Maximum execution time of 30 seconds exceeded

Am I doing something wrong?

Please sign in or create an account to participate in this conversation.