forked from projects/fipamo
32 lines
660 B
PHP
32 lines
660 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
|
|
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;
|
|
}
|
|
}
|