<?
// Wriiten by Spike^ekipS <spike@spikeekips.net>

include_once "./setting.php";

include_once $global["root"] . "/include/handle.php";
include_once $global["root"] . "/include/print_array.php";
include_once $global["root"] . "/include/print_time.php";

//include_once $global["root"] . "/module/message/function/xmlrpc.php";
include_once $global["root"] . "/module/message/function/do.php";

//-------------------------------------------------- execute

include_once $global["root"] . "/lib/Site.php";
include_once $global["root"] . "/lib/Payload.php";
include_once $global["root"] . "/lib/EmailData.php";

$Site = new Site;
$Site->init("mail");

extract($_POST);

if (!trim($To)) {
	goprev();
} else if (!ereg("@", $To)) {
	$To = $To . "@" . $_SESSION["config_domain"];
}

$EmailData = new EmailData;

$var["to"] = trim($To);
$var["cc"] = $Cc;
$var["subject"] = $EmailData->decode($Subject);
$var["body"] = $EmailData->decode($body);

if (! $delSignature) {
	$var["delSignature"] = "";
} else {
	$var["delSignature"] = $delSignature;
}

if (! $isHtml) {
	$var["isHtml"] = "";
} else {
	$var["isHtml"] = $isHtml;
}

if (send_mail($var)) {
	// payload test
	$Payload = new Payload;
	$Payload->clean();

	$url = "Location: " . $_SESSION["user_www_url"] . "/mail?no=3";

	$Site->end1();

	Header($url);
	exit;
} else {
	$Site->end1();

	goprev();
}

/*
Changelog
---------
Mon Mar  3 11:14:56 KST 2003
- retouched.

Mon Mar  3 11:15:04 KST 2003
- big file size(larger than 1047552) can not be inserted into queue table.
  It was caused  from the limitation of 'post_max_size', 'upload_max_filesize'
  (PHP) and 'max_allowed_packet' (MySQL).

  So set it high!
  -----------------
  post_max_size = 20M
  upload_max_filesize = 20M
  (Edit php.ini)

  max_allowed_packet = 200000000
  (mysql> set max_allowed_packet = 200000000;)

Wed Mar  5 17:55:43 KST 2003
- sendmailThruXMLRPC() added.

Mon Jul 21 03:09:22 KST 2003
- new authentication system applied.

*/

?>
