Using Mailgun for Email Dispatch in Laravel

Encountering a timeout when sending emails via Mailgun in Laravel. Revised code snippets:

$bufferLine = stream_get_line($this->mainStream, 1024, PHP_EOL);
Route::post('/mailing', 'EmailHandler@dispatch');
public function dispatch() {
  $details = ['subject' => 'Notice'];
  Mail::send('mailer.alert', $details, function($mailer) {
    $mailer->from('[email protected]', 'DemoUser');
    $mailer->to('[email protected]')->subject('Sent Successfully');
  });
  return redirect('/dashboard');
}

i had similar issue; i ended up using queued email sending and tweaking timeout settings. check your mailgun api config too, maybe its a ssl issue. hope that helps and resolves the delay