summaryrefslogtreecommitdiffstats
path: root/sendmail.php
diff options
context:
space:
mode:
authorMischa Peters <mpeters@high5.nl>2015-08-18 15:38:31 +0200
committerMischa Peters <mpeters@high5.nl>2015-08-18 15:38:31 +0200
commit5495f1b071e0ac62a7d72b00440498f02a6d07e2 (patch)
treecc358a519e50d1e4fe09a043c01af3512deb6cae /sendmail.php
Last release created by Mischa
Diffstat (limited to 'sendmail.php')
-rw-r--r--sendmail.php87
1 files changed, 87 insertions, 0 deletions
diff --git a/sendmail.php b/sendmail.php
new file mode 100644
index 0000000..668a098
--- /dev/null
+++ b/sendmail.php
@@ -0,0 +1,87 @@
+<?php
+//
+// Postfix Admin
+// by Mischa Peters <mischa at high5 dot net>
+// Copyright (c) 2002 - 2005 High5!
+// License Info: http://www.postfixadmin.com/?file=LICENSE.TXT
+//
+// File: sendmail.php
+//
+// Template File: sendmail.tpl
+//
+// Template Variables:
+//
+// tMessage
+// tFrom
+// tSubject
+// tBody
+//
+// Form POST \ GET Variables:
+//
+// fTo
+// fSubject
+// fBody
+//
+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'] == "GET")
+{
+ include ("./templates/header.tpl");
+ include ("./templates/menu.tpl");
+ include ("./templates/sendmail.tpl");
+ include ("./templates/footer.tpl");
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST")
+{
+ $fTo = escape_string ($_POST['fTo']);
+ $fFrom = $SESSID_USERNAME;
+ $fHeaders = "To: " . $fTo . "\n";
+ $fHeaders .= "From: " . $fFrom . "\n";
+
+ if (!empty ($PALANG['charset']))
+ {
+ $fHeaders .= "Subject: " . encode_header (escape_string ($_POST['fSubject']), $PALANG['charset']) . "\n";
+ $fHeaders .= "MIME-Version: 1.0\n";
+ $fHeaders .= "Content-Type: text/plain; charset=" . $PALANG['charset'] . "\n";
+ $fHeaders .= "Content-Transfer-Encoding: 8bit\n";
+ }
+ else
+ {
+ $fHeaders .= "Subject: " . escape_string ($_POST['fSubject']) . "\n\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_succes'];
+ }
+ }
+
+ include ("./templates/header.tpl");
+ include ("./templates/menu.tpl");
+ include ("./templates/sendmail.tpl");
+ include ("./templates/footer.tpl");
+}
+?>