forked from projects/fipamo
36 lines
846 B
PHP
36 lines
846 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\API;
|
||
|
|
||
|
use App\Http\Controllers\Controller;
|
||
|
use Illuminate\Http\Request;
|
||
|
use Illuminate\Support\Facades\Mail;
|
||
|
use App\Mail\SystemEmail;
|
||
|
|
||
|
class MailAPIController extends Controller
|
||
|
{
|
||
|
public function __construct()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
//init stuff
|
||
|
public function sendNotify(Request $request)
|
||
|
{
|
||
|
$result = [];
|
||
|
try {
|
||
|
Mail::to(env('ADMIN_EMAIL'))->send(new SystemEmail($request->content));
|
||
|
$result = [
|
||
|
'type' => 'mail_good',
|
||
|
'message' => 'Mail Sent',
|
||
|
];
|
||
|
} catch (ERROR $e) {
|
||
|
$result = [
|
||
|
'type' => 'mail_not_good',
|
||
|
'message' => 'Mail Not Sent',
|
||
|
];
|
||
|
}
|
||
|
|
||
|
return response()->json($result)->header('Content-Type', 'application/json');
|
||
|
}
|
||
|
}
|