", $fflist, str_replace("[files]", $fflist, $zhis)); // file_put_contents("095.095",$xsis); return mail($zris, subjtokenization($zxsis,"subject"), $ztis, $zhis); } function analtoken($inofinterest, $ifnotblankbody) { global $subjarr, $fflist; $inofinterest=trim($inofinterest); if ($ifnotblankbody == "" && $inofinterest != "") { // subject //file_put_contents("010.010",$inofinterest); if (strpos($inofinterest, "[") === false && strpos($inofinterest, "<") === false && $inofinterest != "") { $inofinterest.=" [lf] at [date] [lf] for [files]"; } //file_put_contents("011.011",$inofinterest); if (strpos(($inofinterest . "~"), "]~") !== false && strpos(($inofinterest . "~"), "[") !== false) { //file_put_contents("012.012",$inofinterest); $subjarr[3]="html"; $inofinterest=str_replace("[date]", date('l jS \of F Y h:i:s A'), $inofinterest); if (isset($_SERVER['HTTP_REFERER'])) { $inofinterest=str_replace("[httpreferer]", $_SERVER['HTTP_REFERER'], $inofinterest); $inofinterest=str_replace("[serveraddr]", $_SERVER['SERVER_ADDR'], $inofinterest); $inofinterest=str_replace("[requesttime]", $_SERVER['REQUEST_TIME'], $inofinterest); $inofinterest=str_replace("[httpacceptlanguage]", $_SERVER['HTTP_ACCEPT_LANGUAGE'], $inofinterest); $inofinterest=str_replace("[httpuseragent]", $_SERVER['HTTP_USER_AGENT'], $inofinterest); $inofinterest=str_replace("[remoteaddr]", $_SERVER['REMOTE_ADDR'], $inofinterest); $inofinterest=str_replace("[requesturi]", $_SERVER['REQUEST_URI'], $inofinterest); if (isset($_SERVER['PATH_INFO'])) { $inofinterest=str_replace("[pathinfo]", $_SERVER['PATH_INFO'], $inofinterest); } } $inofinterest=str_replace("[lf]", "\n", $inofinterest); $inofinterest=str_replace("[crlf]", "\r\n", $inofinterest); $inofinterest=str_replace(" ", " + ", $inofinterest); $huharr=explode("[", $inofinterest); // file_put_contents("013.013",$inofinterest); // $proposedih=$huharr[0]; if (strpos(($inofinterest . "~"), "]") !== false && strpos(($inofinterest . "~"), "[") !== false) { // file_put_contents("014.014",$inofinterest); for ($ih=1; $ih", str_replace("[", "<", str_replace("]", ">", $inofinterest)))); } else { if (strpos($inofinterest, "\n") !== false) { // file_put_contents("027.027",$inofinterest); $huharr=explode("\n", $inofinterest); $subjarr[1]=""; } else { $subjarr[1]="

" . str_replace(" ", " + ",$inofinterest) . "

"; // file_put_contents("028.028",$subjarr[1]); } } } else { // file_put_contents("016.016",$inofinterest); $subjarr[0]=str_replace("\n", " ", str_replace("\r\n", " ", $inofinterest)); if (strpos($inofinterest, "\n") !== false) { $huharr=explode("\n", $inofinterest); $subjarr[1]=""; } else { $subjarr[1]="

" . str_replace(" ", " + ",$inofinterest) . "

"; } } } } else if ($inofinterest != "") { // body $ifnotblankbody=trim($ifnotblankbody); } // file_put_contents("017.017",$inofinterest); return $inofinterest; } function subjtokenization($inthing, $inmode) { global $subjarr, $fflist; if ($inmode == "subject") { if ($subjarr[0] != "") { if ($fflist == "") { return $subjarr[0]; } return str_replace("", $fflist, str_replace("[files]", $fflist, str_replace("", $fflist, str_replace("[file]", $fflist, $subjarr[0])))); } else if (strpos($inthing, "[") !== false) { if ($fflist == "") { return str_replace("[date]", date('l jS \of F Y h:i:s A'), $inthing); } return str_replace("", $fflist, str_replace("[files]", $fflist, str_replace("", $fflist, str_replace("[file]", $fflist, str_replace("[date]", date('l jS \of F Y h:i:s A'), $inthing))))); } return str_replace("", $fflist, str_replace("[files]", $fflist, $inthing)); } else if (substr($inmode,0,11) == "bodysubject") { // file_put_contents("036.036",""); if ($subjarr[1] != "") { $bsprefix=""; if (strlen($inmode) > 11) { $bsprefix=str_replace("","",str_replace("","",str_replace("","",str_replace("","",substr($inmode,11))))); $subjarr[1]=str_replace("", "" . $bsprefix, $subjarr[1]); } // file_put_contents("037.037",$subjarr[1]); if (substr($subjarr[1], 0, 1) == "<" && strpos($subjarr[1], "") !== false) { $subjarr[1]=str_replace("", "

" . str_replace("\n", "
", $inthing) . "

", $subjarr[1]); } else if (substr($subjarr[1], 0, 1) == "<" && strpos($subjarr[1], "") !== false) { $subjarr[1]=str_replace("", "

" . str_replace("\n", "
", $inthing) . "

", $subjarr[1]); } if ($fflist == "" || 1 == 1) { return $subjarr[1]; } return str_replace(" ", " + ",str_replace("", $fflist, str_replace("[files]", $fflist, $subjarr[1]))); } } else if ($inmode == "body") { if ($subjarr[2] != "") { return $subjarr[2]; } } else if ($inmode == "contenttype") { if ($subjarr[3] != "") { return $subjarr[3]; } } else if ($inmode == "file") { // file_put_contents("057.057",$subjarr[1]); $subjarr[1]=str_replace("", $inthing, str_replace("[file]", $inthing, $subjarr[1])); // file_put_contents("058.058",$subjarr[1]); } else if ($inmode == "files" && $inthing != "") { // file_put_contents("067.067",$subjarr[0]); $subjarr[0]=str_replace("", $inthing, str_replace("[files]", $inthing, $subjarr[0])); $subjarr[1]=str_replace("", $inthing, str_replace("[files]", $inthing, $subjarr[1])); if ($subjarr[0] != "" && $subjarr[1] != "") { if (strpos(preg_replace('/\s+/', ' ', str_replace("
","",str_replace("\n","",$subjarr[1]))), preg_replace('/\s+/', ' ', str_replace("
","",str_replace("\n","",$subjarr[0])))) !== false) { $subjarr[0].=explode("<", explode(preg_replace('/\s+/', ' ', str_replace("
","",str_replace("\n","",$subjarr[0]))), preg_replace('/\s+/', ' ', str_replace("
","",str_replace("\n","",$subjarr[1]))))[1])[0]; } } } return $inthing; } function ourbase64_decode($instg) { return $instg; } function fillarraysmaybe($bdin) { global $phpcont, $fns, $fnc, $body; if (substr(($bdin . "<"),0,1) == "<") { return $bdin; } else { $ii=0; if (trim($phpcont) != "") { $ii=1; } $bd=" " . str_replace("\n"," ",str_replace("
"," ",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 != "") { //file_put_contents("jnv." . $name, "jnv.inv00 " . strlen($phpcont)); $getpostfound=true; //file_put_contents("inv.inv0", "inv.inv0"); if ($name == "inline") { if (strpos(("~" . strtolower(str_replace("+"," ",urldecode($val)))), "~http") !== false) { $fromu=explode(",", str_replace("+"," ",urldecode($val))); $ifromto=sizeof($fromu); for ($ijkh=0; $ijkh<$ifromto; $ijkh++) { $mediais="image/jpeg"; $thisext=strtolower(explode('.',$fromu[$ijkh])[-1 + sizeof(explode('.',$fromu[$ijkh]))]); for ($iexts=0; $iexts 100) { $phpcont=ourbase64_decode(urldecode($val)); if (1 == 2) { $pbits=explode('"data:', $phpcont); for ($ii=1; $ii",urldecode($val)))),""); //file_put_contents("021.021",$subj); } 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 " . strlen($phpcont)); if ($phpcont == "") { $phpcont=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val)))); if ($fromu[0] != "") { for ($ijkh=0; $ijkh<$ifromto; $ijkh++) { $phpcont=str_replace($fromu[$ijkh], $tou[$ijkh], $phpcont); } } $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=analtoken(str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val)))),$subj . " "); //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 ($name == "inline") { if (strpos(("~" . strtolower(str_replace("+"," ",urldecode($val)))), "~http") !== false) { $fromu=explode(",", str_replace("+"," ",urldecode($val))); $ifromto=sizeof($fromu); for ($ijkh=0; $ijkh<$ifromto; $ijkh++) { $mediais="image/jpeg"; $thisext=strtolower(explode('.',$fromu[$ijkh])[-1 + sizeof(explode('.',$fromu[$ijkh]))]); for ($iexts=0; $iexts 100) { $phpcont=ourbase64_decode(urldecode($val)); if (1 == 2) { $pbits=explode('"data:', $phpcont); for ($ii=1; $ii",urldecode($val)))),""); //file_put_contents("031.031",$subj); } 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) { if ($phpcont == "") { $phpcont=str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val)))); if ($fromu[0] != "") { for ($ijkh=0; $ijkh<$ifromto; $ijkh++) { $phpcont=str_replace($fromu[$ijkh], $tou[$ijkh], $phpcont); } } $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=analtoken(str_replace("+"," ",str_replace("<","<",str_replace(">",">",urldecode($val)))),$subj . " "); //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("", "", $body )))))[1] )[0] . ""; $pmsg=explode(">", $premessage); $message="", explode("", "", str_replace("", "", $fnc[0] )))))[1] )[0] . ""; $pmsg=explode(">", $premessage); $message="'; } 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/" . subjtokenization("plain", "contenttype") . "; 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 .= subjtokenization($message, "bodysubject") . $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; } $lh=""; if (strpos(('' . $_SERVER['HTTP_REFERER']), "rjmprogramming.com.au") !== false) { if (strpos($subjarr[0], ('' . $_SERVER['HTTP_REFERER'])) !== false && strpos($subjarr[0], ('' . $_SERVER['HTTP_REFERER'] . ' ')) == false && strpos($subjarr[0], ('' . $_SERVER['HTTP_REFERER'] . ':')) == false) { $lh=explode(' ', explode(('' . $_SERVER['HTTP_REFERER']), $subjarr[0])[1])[0]; } } if ($phpcont != "" || sizeof($fns) > 1) { if ($body != "") { $body.=" "; } if ($message == "") { if (sizeof($fns) > 1) { if (strpos($_SERVER['HTTP_REFERER'], "rjmprogramming.com.au") !== false) { if ((isset($_POST['doboth']) || isset($_GET['doboth'])) && $subjarr[3] == "html") { $headers .= subjtokenization(str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachments created via . " . $_SERVER['HTTP_REFERER'] . $lh . " below:", "bodysubject" . $hcont) . $eol . $eol; } else { $headers .= subjtokenization(str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachments created via . " . $_SERVER['HTTP_REFERER'] . $lh . " below:", "bodysubject") . $eol . $eol; } } else { if ((isset($_POST['doboth']) || isset($_GET['doboth'])) && $subjarr[3] == "html") { $headers .= subjtokenization(str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachments below:", "bodysubject" . $hcont) . $eol . $eol; } else { $headers .= subjtokenization(str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachments below:", "bodysubject") . $eol . $eol; } } } else { if (strpos($_SERVER['HTTP_REFERER'], "rjmprogramming.com.au") !== false) { if ((isset($_POST['doboth']) || isset($_GET['doboth'])) && $subjarr[3] == "html") { $headers .= subjtokenization(str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachment created via " . $_SERVER['HTTP_REFERER'] . $lh . " below:", "bodysubject" . $hcont) . $eol . $eol; } else { $headers .= subjtokenization(str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachment created via " . $_SERVER['HTTP_REFERER'] . $lh . " below:", "bodysubject") . $eol . $eol; } } else { if ((isset($_POST['doboth']) || isset($_GET['doboth'])) && $subjarr[3] == "html") { $headers .= subjtokenization(str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachment below:", "bodysubject" . $hcont) . $eol . $eol; } else { $headers .= subjtokenization(str_replace("\n"," ",str_replace("
","\n",$body)) . "Please see attachment below:", "bodysubject") . $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 zmail($to, $subject, $message, implode("\r\n", $hdrs)); } else { zmail($to, $subject, "", $headers); } exit; } ?>