mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
a00d456084
- encode_header(): made charset parameter optional, defaults to utf-8 - db_delete(): escape_string() $where and $delete create-mailbox.php: - always encode mail header and insert Content-Type etc. headers (previous code never did this, $PALANG['charset'] is not set in any language. so this code part was never used) sendmail.php: - always encode mail header and insert Content-Type etc. headers (had the same bug as create-mailbox.php) - merge GET and POST These changes fix http://sourceforge.net/tracker/index.php?func=detail&aid=1811214&group_id=191583&atid=937964 git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@199 a1433add-5e2c-0410-b055-b7f2511e0802
84 lines
1.9 KiB
PHP
84 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* Postfix Admin
|
|
*
|
|
* LICENSE
|
|
* This source file is subject to the GPL license that is bundled with
|
|
* this package in the file LICENSE.TXT.
|
|
*
|
|
* Further details on the project are available at :
|
|
* http://www.postfixadmin.com or http://postfixadmin.sf.net
|
|
*
|
|
* @version $Id$
|
|
* @license GNU GPL v2 or later.
|
|
*
|
|
* File: sendmail.php
|
|
* Used to send an email to a user.
|
|
* Template File: sendmail.tpl
|
|
*
|
|
* Template Variables:
|
|
*
|
|
* tMessage
|
|
* tFrom
|
|
* tSubject
|
|
* tBody
|
|
*
|
|
* Form POST \ GET Variables:
|
|
*
|
|
* fTo
|
|
* fSubject
|
|
* fBody
|
|
*/
|
|
|
|
require_once('common.php');
|
|
|
|
authentication_require_role('admin');
|
|
|
|
(($CONF['sendmail'] == 'NO') ? header("Location: " . $CONF['postfix_admin_url'] . "/main.php") && exit : '1');
|
|
|
|
$SESSID_USERNAME = authentication_get_username();
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] == "POST")
|
|
{
|
|
$fTo = safepost('fTo');
|
|
$fFrom = $SESSID_USERNAME;
|
|
$fHeaders = "To: " . $fTo . "\n";
|
|
$fHeaders .= "From: " . $fFrom . "\n";
|
|
|
|
$fHeaders .= "Subject: " . encode_header(safepost('fSubject')) . "\n";
|
|
$fHeaders .= "MIME-Version: 1.0\n";
|
|
$fHeaders .= "Content-Type: text/plain; charset=utf-8\n";
|
|
$fHeaders .= "Content-Transfer-Encoding: 8bit\n";
|
|
|
|
$fHeaders .= 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 (!smtp_mail ($fTo, $fFrom, $fHeaders))
|
|
{
|
|
$tMessage .= $PALANG['pSendmail_result_error'];
|
|
}
|
|
else
|
|
{
|
|
$tMessage .= $PALANG['pSendmail_result_success'];
|
|
}
|
|
}
|
|
}
|
|
|
|
include ("./templates/header.tpl");
|
|
include ("./templates/menu.tpl");
|
|
include ("./templates/sendmail.tpl");
|
|
include ("./templates/footer.tpl");
|
|
|
|
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
|
|
?>
|