fipamo/brain/api/v1/MailerAPI.php
Are0h 63eaba08e2 Added config for PHP formatting (PSR2)
I needed some consistent php formatting, so I plugged in a php fixer
config and then reformatted all PHP files so it's all consistent.

Fixed an ID issue with the page-edit template that was causing page
editing to fail.
2022-05-16 17:41:15 -07:00

32 lines
730 B
PHP

<?php
namespace brain\api\v1;
use brain\data\Session;
use brain\utility\Mailer;
class MailerAPI
{
public function __construct()
{
}
public static function handleMail($request, $body, $response)
{
// if testing, verify session is active
// add clean method for sending programmtic emails
if ($body['mail_task'] == 'TESTING') {
if (Session::active()) {
$result = Mailer::sendmail($body);
} else {
$result = [
'message' => 'You need to be logged in for this, champ.',
'type' => 'MAILER_ERROR',
];
}
} else {
}
return $result;
}
}