UPD: changed to base64 mime type
This commit is contained in:
parent
c2eb9b55ba
commit
5f84ba1b4d
28
php/mailapi.php
Normal file
28
php/mailapi.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?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.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user