4 // by Mischa Peters <mischa at high5 dot net>
5 // Copyright (c) 2002 - 2005 High5!
6 // License Info: http://www.postfixadmin.com/?file=LICENSE.TXT
10 // Template File: sendmail.tpl
12 // Template Variables:
19 // Form POST \ GET Variables:
25 require ("./variables.inc.php");
26 require ("./config.inc.php");
27 require ("./functions.inc.php");
28 include ("./languages/" . check_language () . ".lang");
30 $SESSID_USERNAME = check_session ();
32 if ($_SERVER['REQUEST_METHOD'] == "GET")
34 include ("./templates/header.tpl");
35 include ("./templates/menu.tpl");
36 include ("./templates/sendmail.tpl");
37 include ("./templates/footer.tpl");
40 if ($_SERVER['REQUEST_METHOD'] == "POST")
42 $fTo = escape_string ($_POST['fTo']);
43 $fFrom = $SESSID_USERNAME;
44 $fHeaders = "To: " . $fTo . "\n";
45 $fHeaders .= "From: " . $fFrom . "\n";
47 if (!empty ($PALANG['charset']))
49 $fHeaders .= "Subject: " . encode_header (escape_string ($_POST['fSubject']), $PALANG['charset']) . "\n";
50 $fHeaders .= "MIME-Version: 1.0\n";
51 $fHeaders .= "Content-Type: text/plain; charset=" . $PALANG['charset'] . "\n";
52 $fHeaders .= "Content-Transfer-Encoding: 8bit\n";
56 $fHeaders .= "Subject: " . escape_string ($_POST['fSubject']) . "\n\n";
59 $fHeaders .= escape_string ($_POST['fBody']);
61 if (empty ($fTo) or !check_email ($fTo))
64 $tTo = escape_string ($_POST['fTo']);
65 $tSubject = escape_string ($_POST['fSubject']);
66 $tBody = escape_string ($_POST['fBody']);
67 $tMessage = $PALANG['pSendmail_to_text_error'];
72 if (!smtp_mail ($fTo, $fFrom, $fHeaders))
74 $tMessage .= $PALANG['pSendmail_result_error'];
78 $tMessage .= $PALANG['pSendmail_result_succes'];
82 include ("./templates/header.tpl");
83 include ("./templates/menu.tpl");
84 include ("./templates/sendmail.tpl");
85 include ("./templates/footer.tpl");