opensmtpdadmin/sendmail.php

61 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2022-08-18 14:01:52 +02:00
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: sendmail.php
//
// Template File: sendmail.tpl
//
// Template Variables:
//
// tMessage
// tFrom
// tSubject
// tBody
//
// Form POST \ GET Variables:
//
// fTo
// fSubject
// fBody
//
require("./session.inc.php");
2022-08-18 14:01:52 +02:00
require("./variables.inc.php");
require("./config.inc.php");
require("./functions.inc.php");
include("./languages/" . check_language() . ".lang");
$SESSID_USERNAME = check_session();
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$fTo = escape_string($_POST['fTo']);
$fSubject = escape_string($_POST['fSubject']);
$fHeaders = "From: " . $SESSID_USERNAME . "\r\n";
$fHeaders .= "Content-Type: text/plain; charset=utf-8\r\n";
$fBody = escape_string($_POST['fBody']);
if (empty($fTo) or !check_email($fTo)) {
$error = 1;
$tTo = escape_string($_POST['fTo']);
$tSubject = escape_string($_POST['fSubject']);
$tBody = escape_string($_POST['fBody']);
$tMessage = $PALANG['pSendmail_to_text_error'];
}
if ($error != 1) {
if (!mail($fTo, $fSubject, $fBody, $fHeaders)) {
$tMessage .= $PALANG['pSendmail_result_error'];
} else {
$tMessage .= $PALANG['pSendmail_result_succes'];
}
}
}
include("./templates/header.tpl");
include("./templates/menu.tpl");
include("./templates/sendmail.tpl");
include("./templates/footer.tpl");
?>