<?php
$test = 0;
if (!getenv('QUERY_STRING')) { echo "What you trying to do?"; }
else { $qs = getenv('QUERY_STRING');
set_details($qs); }
function set_details($qs)
{
if (strpos($qs,'=') == FALSE )
{
echo 'Sorry, incorect string.';
}
else
{
global $details, $to, $from, $reply, $sub, $msg;
$set_array = explode('+',$qs);
foreach ($set_array as $a)
{
if (strpos($a,'=') == FALSE )
{
echo 'Sorry, incorect string.';
return;
}
else
{
$b = explode('=',$a);
$details["$b[0]"] = $b[1];
}
unset($a, $b);
}
if (! $details['to'])
{ echo 'No \'to\', can\'t send'; return; }
else
{ $to = $details['to']; }
if (! $details['sub'])
{ $sub = 'na'; }
else
{ $sub = $details['sub']; }
if (! $details['msg'])
{ echo 'no \'msg\', can\'t send.'; return; }
else
{ $msg = $details['msg']; }
if (! $details['from'])
{ $from = 'yourmail@mail.com'; }
else
{ $from = $details['from'] && $reply = $details['from']; }
}
}
if (! $test) {
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: you <' . $to . '>' . "\r\n";
$headers .= 'From: AutoWeb <' . $from . '>' . "\r\n";
$headers .= 'Reply-To: Webmaster <' . $reply . '>' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
if (strpos($sub,"%20") == TRUE)
{ $sub = str_replace("%20"," ",$sub); }
if (strpos($msg,"%20") == TRUE)
{ $msg = str_replace("%20"," ",$msg); }
if (mail($to, $sub, $msg, $headers)) {
echo("<p>HEADER: $headers</p><p>TO: $to</p><p>SUB: $sub</p><p>MESSAGE: $msg</p><p>Message successfully sent!</p>");
} else {
echo("<p>HEADER: $headers</p><p>TO: $to</p><p>SUB: $sub</p><p>MESSAGE: $msg</p><p>Message delivery failed...</p>");
}
}
?>