I haven't run across this before but have had nothing but successes with Laravel Mailable, so I have no true reason to doubt it now. In my application, I have an attachments section to a record. In that section, I give users the options to select attachment that they would like to mail to a email.
My problem is that as of now, using the below current controller, sometimes the send process can take an incredibly long time (at this time, one example was sent only after 3.67 minutes !!). I understand that this might be partially because of the size, but I'm concerned about this timing and would like to see if there might be a backend alternative (such as queue).
At the moment here is my controller for the command to send to the mailable:
public function attachmentsEmail(Request $request){
$shipment = Shipment::findOrFail($request->shipmentID);
$attachment = Shipment_Attachment::findOrFail($request->attachmentID);
$storagePath = Storage::url($attachment->attachmentPath);
$customMessage = $request->customMessage;
$email = $request->email;
Mail::to($email)->send(new shipmentAttachments($shipment, $attachment, $storagePath, $customMessage)); //maybe try to use queue instead of send...
return response()->json([
'shipment' => $shipment,
'customMessage' => $customMessage,
'email' => $email
]);
}
We are currently using Windows Server, so while I would like to use queue, I cannot use supervisor to maintain my queues.
However, if there are other suggestions, I'm willing to take them. I'm still relatively new at this and understand that there may be better ways of handling these issues.
Thanks - Matt
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire