Check your log at storage/logs/laravel.log
Oct 23, 2020
12
Level 50
Internal server error 500 while calling POST API (Laravel)
Hi, I have created one POST API for sending mails. When I am calling this API I am getting an error like this
Http failure response for http://starshipllp.com/starship-backend/public/api/sendEmail: 500 Internal Server Error full detail error
error:
message: "Server Error"
__proto__: Object
headers: Ep
lazyInit: ()=> {…}
arguments: (...)
caller: (...)
length: 0
name: ""
__proto__: ƒ ()
[[FunctionLocation]]: main-es2015.6970d90….js:1
[[Scopes]]: Scopes[4]
lazyUpdate: null
normalizedNames: Map(0) {}
__proto__: Object
message: "Http failure response for http://starshipllp.com/starship-backend/public/api/sendEmail: 500 Internal Server Error"
name: "HttpErrorResponse"
ok: false
status: 500
statusText: "Internal Server Error"
url: "http://starshipllp.com/starship-backend/public/api/sendEmail"
my controller
public function sendMail(Request $request)
{
$data = $this->validate($request,[
'name' => 'required',
'email' => 'required',
'phone' => 'required',
'address' => 'required',
'orders' => 'required',
'grandTotal' => 'required'
]);
$emails = [$request->email,'[email protected]'];
Mail::to($emails)->send(new SendOrderEmail($data));
return response()->json(['success' => true,'data' => 'Order Placed Successfully']);
}
I don't know what is wrong in my code.
Level 102
Then I am quite certain that this is a server error (the error in your first post even says so). What server are you running on (nginx or apache)? Can you find the log?
Please or to participate in this conversation.