<?
//   XUL Webmail, a web based mailclient
//
//   Copyright (C) 2004 Wouter van Wijk (wvw@dds.nl),
//   based on XUL Channels, Copyright (C) 2003 Tim Broddin
//
//   This program is free software; you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation; either version 2 of the License, or
//   (at your option) any later version.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program; if not, write to the Free Software
//   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// session check
session_start();
if (!isset($_SESSION['user']))
{
	header("Location: error.php?ec=2");
	exit;
}

$to = $HTTP_POST_VARS["to"];
$message = $HTTP_POST_VARS["message"];
$message2 = str_replace("&","\n\n", 'test&' . $message);
$subject=$HTTP_POST_VARS["subject"];
$email=$SESSION_MAIL_ADDRESS;
mail($to, $subject, $message2, "From: $email\r\n");
echo "<html><body><h1>Message sent</h1>to=$to<br />msg=$message<br />subject=$subject<br />email=$email<br /><a href=\"#\" onclick=\"javascript:window.close();\">Close</a></body></html>";
?>

