"," ",str_replace("#"," ",str_replace("&"," ",str_replace("?"," ",str_replace(","," ",$bdin)))))) . " ";
//file_put_contents("inv.inv9", $bd);
$htbits=explode(" http", str_replace(" HTTP", " http", $bd));
if (sizeof($htbits) > 1) {
for ($hi=1; $hi 0 && strpos(substr($htbits[$hi],0),".") !== false && strlen(substr($htbits[$hi],0)) > 2) {
$fcc="";
if (strtolower(substr($htbits[$hi],0,1)) == "s") {
try {
$fcc=file_get_contents("http" . explode(" ", substr($htbits[$hi],1))[0]);
} catch (Exception $ee) {
$fcc="";
}
} else {
try {
$fcc=file_get_contents("http" . explode(" ", substr($htbits[$hi],0))[0]);
} catch (Exception $ee) {
$fcc="";
}
}
if ($fcc != "") {
$fnc[$ii]=chunk_split(base64_encode($fcc));
$fns[$ii]=explode("#", explode("?", explode("/", explode(" ", substr($htbits[$hi],0))[0])[-1 + sizeof(explode(" ", substr($htbits[$hi],0)))])[0])[0];
$ii++;
}
}
}
}
$htbits=explode(" ", $bd);
if (sizeof($htbits) > 1) {
for ($hi=1; $hi 0 && strpos(substr($htbits[$hi],0),".") !== false && strlen(substr($htbits[$hi],0)) > 2 && strpos(strtolower(" " . substr($htbits[$hi],0)), " http") === false) {
//file_put_contents("inv.inv99", "" . $ilen);
$fcc="";
if (strpos(strtolower(" " . substr($htbits[$hi],0)), " //") !== false) {
try {
$fcc=file_get_contents("http:" . explode(" ", substr($htbits[$hi],0))[0]);
} catch (Exception $ee) {
$fcc="";
}
} else if (file_exists(substr($htbits[$hi],0))) {
//file_put_contents("inv.inv999", "" . explode(" ", substr($htbits[$hi],0))[0]);
try {
$fcc=file_get_contents(explode(" ", substr($htbits[$hi],0))[0]);
//file_put_contents("inv.inv9999", "" . strlen($fcc));
} catch (Exception $ee) {
$fcc="";
//file_put_contents("inv.inv99990", "" . strlen($fcc));
}
}
if ($fcc != "") {
//file_put_contents("inv.inv999909", "" . explode("#", explode("?", explode("/", explode(" ", substr($htbits[$hi],0))[0])[-1 + sizeof(explode(" ", substr($htbits[$hi],0)))])[0])[0]);
$fnc[$ii]=chunk_split(base64_encode($fcc));
$fns[$ii]=explode("#", explode("?", explode("/", explode(" ", substr($htbits[$hi],0))[0])[-1 + sizeof(explode(" ", substr($htbits[$hi],0)))])[0])[0];
$ii++;
}
}
}
}
if ($fns[0] != "" && $phpcont == "") { $phpcont=" "; }
return $bdin;
}
}
$getpostfound=false;
foreach( $_POST as $name=>$val ) {
//file_put_contents("inv.preinv0", "inv.inv0");
if ($val != "") {
$getpostfound=true;
//file_put_contents("inv.inv0", "inv.inv0");
if (strpos($name, "subj") !== false) {
$subj=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
} else if (strpos(str_replace("
"," ",str_replace("+"," ",str_replace("<","<",str_replace(">",">",strtolower(urldecode($val)))))), "<") !== false && strpos(str_replace("
"," ",str_replace("+"," ",str_replace("<","<",str_replace(">",">",strtolower(urldecode($val)))))), ">") !== false) {
//file_put_contents("inv.inv00", "inv.inv00");
$phpcont=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
$pbits=explode('"data:', $phpcont);
for ($ii=1; $ii",strtolower(urldecode($val))))), "@") !== false) {
//file_put_contents("inv.inv000", "inv.inv000");
if ($to == "") {
$to=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
} else if ($cc == "") {
$cc=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
} else {
$bcc=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
}
} else if (str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',$subj)))))))))) == "") {
$subj=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
if (str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',$subj)))))))))) == "") {
$subj="";
}
} else if (substr(($phpcont . " "),0,1) != "<") {
//file_put_contents("inv.postinv0", $body);
//file_put_contents("inv.inv0000", "inv.inv0000");
$body=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
//file_put_contents("inv.postinv0", $body);
//file_put_contents("inv.inv", $body);
fillarraysmaybe($body);
//file_put_contents("inv.ouv", "" . sizeof($fnc) . " " . $body);
}
}
}
foreach( $_GET as $name=>$val ) {
//file_put_contents("inv.invxxx00", "");
if ($val != "") {
//file_put_contents("inv.invzzz00", "");
$getpostfound=true;
if (strpos($name, "subj") !== false) {
$subj=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
} else if (strpos(str_replace("
"," ",str_replace("+"," ",str_replace("<","<",str_replace(">",">",strtolower(urldecode($val)))))), "<") !== false && strpos(str_replace("
"," ",str_replace("+"," ",str_replace("<","<",str_replace(">",">",strtolower(urldecode($val)))))), ">") !== false) {
$phpcont=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
$pbits=explode('"data:', $phpcont);
for ($ii=1; $ii",strtolower(urldecode($val))))), "@") !== false) {
if ($to == "") {
$to=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
} else if ($cc == "") {
$cc=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
} else {
$bcc=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
}
} else if (str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',$subj)))))))))) == "") {
$subj=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
if (str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',$subj)))))))))) == "") {
$subj="";
}
} else if (substr(($phpcont . " "),0,1) != "<") {
$body=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val))));
//file_put_contents("inv.inv2", $body);
fillarraysmaybe($body);
//file_put_contents("inv.ouv2", "" . sizeof($fnc) . " " . $body);
}
}
}
if (($phpcont . $body) != "" && $to != "") {
$subject = $subj;
if ($subject == "") { $subject="HTML Email Attachment"; }
$eol = PHP_EOL;
$headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
if ($cc != "") { $headers .= 'CC: ' . $cc . $eol; }
if ($bcc != "") { $headers .= 'BCC: ' . $bcc . $eol; }
$headers .= 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
if (trim($phpcont) != "") {
$filename="htmlattachment.html";
$hcont=$phpcont; //'' . str_replace("+", " ", urldecode($_POST['newemailcontent'])) . '
", file_get_contents(dirname(__FILE__) . "/flowchart.html"))[0])[1] . '';
$content = chunk_split(base64_encode($hcont));
$fns[0]=$filename;
$fnc[0]=$content;
}
//$uid = md5(uniqid(time()));
// a random hash will be necessary to send mixed content
$separator = md5(time());
if (isset($_GET['inline']) || isset($_POST['inline'])) {
if (sizeof($fns) == 1) {
if (trim($phpcont) != "" && $body == "") {
$body=$phpcont;
//file_put_contents('inv00x', '' . sizeof($phpcont) . ' ... ' . substr($body,0,45));
}
if (strpos(strtolower($body), '') !== false) {
$message=explode("", str_replace("", "", str_replace("", "", $body )))[0];
} else if (strpos(strtolower($fnc[0]), '') !== false) {
$message=explode("", str_replace("", "", str_replace("", "", $fnc[0] )))[0];
} else if (strpos(strtolower($body), '", explode("", "", str_replace("", "
", explode("", "", str_replace("' . $fnc[0] . '';
} else {
$message = '' . $body . '
';
}
}
}
if ($message == "") {
$headers .= "MIME-Version: 1.0" . $eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"" . $separator . "\"" . $eol . $eol;
$headers .= "Content-Transfer-Encoding: 7bit" . $eol;
$headers .= "This is a MIME encoded message." . $eol . $eol;
// message
$headers .= "--" . $separator . $eol;
} else {
$headers = "MIME-Version: 1.0" . $eol;
}
if ($message == "") {
$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . $eol;
$headers .= "Content-Transfer-Encoding: 8bit" . $eol . $eol;
} else {
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"" . $eol;
$headers .= "Content-Transfer-Encoding: 8bit" . $eol . $eol;
$headers .= $message . $eol . $eol; //"Please see attachments created via HTTP://www.rjmprogramming.com.au/PHP/no_body.php below:" . $eol . $eol;
$headers .= 'To: ' . $emailto . $eol;
$headers .= 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
$headers .= 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;
}
if ($phpcont != "" || sizeof($fns) > 1) {
if ($body != "") { $body.=" "; }
if ($message == "") {
if (sizeof($fns) > 1) {
if (strpos($_SERVER['HTTP_REFERER'], "rjmprogramming.com.au") !== false) {
$headers .= str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachments created via . " . $_SERVER['HTTP_REFERER'] . " below:" . $eol . $eol;
} else {
$headers .= str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachments below:" . $eol . $eol;
}
} else {
if (strpos($_SERVER['HTTP_REFERER'], "rjmprogramming.com.au") !== false) {
$headers .= str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachment created via . " . $_SERVER['HTTP_REFERER'] . " below:" . $eol . $eol;
} else {
$headers .= str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachment below:" . $eol . $eol;
}
}
}
if ($message == "") {
for ($ic=0; $ic","\n",$body)));
$headers .= str_replace("\n"," ",str_replace("
","\n",$body)) . $eol . $eol;
}
$headers .= "--" . $separator . "--";
}
if ($message != "") { // inline HTML
// To send HTML mail, the Content-type header must be set
$hdrs[] = 'MIME-Version: 1.0';
$hdrs[] = 'Content-type: text/html; charset=iso-8859-1';
// Additional headers
$hdrs[] = 'To: ' . $to;
$hdrs[] = 'From: rmetcalfe@rjmprogramming.com.au';
if ($cc != "") { $hdrs[] = 'CC: ' . $cc; }
if ($bcc != "") { $hdrs[] = 'BCC: ' . $bcc; }
$hdrs[] = 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au';
// Mail it
mail($to, $subject, $message, implode("\r\n", $hdrs));
} else {
mail($to, $subject, "", $headers);
}
exit;
}
?>