forked from projects/fipamo
ro
b37e64d062
Removed email settings from settings.json and moved them to the .env file to use Laravel's mailer functionality. references to the old mailer has been removed from settings.json, data sorting class and the settings template file the front end script has also been updated to accomodate different message types, starting with a test message so members can make sure the settings defined in the .env are working
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');
|
|
}
|
|
}
|