I am using below code to send email in Laravel 5.1
Mail::send('Project.Emails.Award', $data, function($message)
{
$message
->to('EmailAddress', 'EmailAddress')
->subject('hi');
});
Here the problem is the above function takes min 5 seconds to complete the processing.
Question : Is there deliver async method s that I don't need to wait for the response ?
Depending on which mail driver you are using or you have to use there may be other options to improve performance. However the most effective way to keep the UI responsive is queueing the mail messages.
With your code this would be as simple as:
Mail::queue('Project.Emails.Award', $data, function($message)
{
$message
->to('EmailAddress', 'EmailAddress')
->subject('hi');
});
You though need to have queueing set up and you won't be able to do this properly on some managed servers.