expmail/sender.php
Klaus-Uwe Mitterer 2eed78b83e Complete refactor: Moving stuff to classes, making sender tiny
Adding two config options to modify behavior
Allow messages with empty body to be sent
Automatically convert HTML to plain if none provided
Version bump to 0.4
2020-09-04 22:01:34 +02:00

23 lines
440 B
PHP

<?php
require_once 'config.php';
require_once 'Mail.class.php';
require_once 'Request.class.php';
try {
$req = new Request(file_get_contents('php://input'));
$mail = Mail::FromRequest($req);
$mail->send();
$response = array(
"status" => "success"
);
} catch (\Exception $e) {
$response = array(
"status" => "error",
"error" => "{$e->getMessage()}"
);
};
echo json_encode($response);