29 lines
780 B
PHP
29 lines
780 B
PHP
<?php
|
|
|
|
if (empty($_POST)) {
|
|
echo 'Usage: curl -d "subject=email subject&sender=SENDER@DOMAIN.TLD&recipient=RECIPIENT@DOMAIN.TLD&message=$(base64 /tmp/mailbody.txt)" -X POST https://racker.pro/mailapi/';
|
|
exit();
|
|
} else {
|
|
|
|
include('Mail.php');
|
|
|
|
$to = $_POST['recipient'];
|
|
$subject = $_POST['subject'];
|
|
$message = $_POST['message'];
|
|
$headers[] = 'MIME-Version: 1.0';
|
|
$headers[] = 'Content-type: text/plain; charset=ISO-8859-1';
|
|
$headers[] = 'Content-Transfer-Encoding: base64';
|
|
$headers[] = 'X-Mailer: PHP/' . phpversion();
|
|
//$headers[] = 'To: ' . $_POST['recipient'];
|
|
$headers[] = 'From: ' . $_POST['sender'];
|
|
|
|
if (mail($to, $subject, $message, implode("\r\n", $headers))) {
|
|
echo 'Your message has been sent.';
|
|
} else {
|
|
echo 'There was a problem sending the email.';
|
|
}
|
|
}
|
|
|
|
?>
|
|
|