'.$_SERVER['REMOTE_ADDR'].'
'."\n".$_SERVER['HTTP_USER_AGENT']."\n".date("d.m.Y H:i:s")."\n\nsnad se ozve ;)"); function dmail($from, $to, $subject, $message, $reply='', $headers='', $helo='v.npx.cz') { if(empty($headers)) { $text=str_replace(" "," ",htmlspecialchars_decode(strip_tags(nl2br($message)))); $body=''.$message.''; $subboundary = "==MULTIPART_BOUNDARY_".md5(time()); $headers = "Accept-Language: cs-CZ, en-US".MAIL_EOL. "Content-Language: cs-CZ".MAIL_EOL. "MIME-Version: 1.0".MAIL_EOL. "Content-Type: multipart/alternative;".MAIL_EOL. " boundary=".chr(34) . $subboundary . chr(34) .MAIL_EOL.MAIL_EOL. "--".$subboundary . MAIL_EOL. "Content-Type: text/plain; charset=\"utf-8\"".MAIL_EOL. "Content-Transfer-Encoding: base64".MAIL_EOL.MAIL_EOL. chunk_split(base64_encode($text)).MAIL_EOL.MAIL_EOL. "--".$subboundary . MAIL_EOL. "Content-Type: text/html; charset=\"utf-8\"".MAIL_EOL. "Content-Transfer-Encoding: base64".MAIL_EOL.MAIL_EOL. chunk_split(base64_encode($body)).MAIL_EOL.MAIL_EOL. "--".$subboundary . "--".MAIL_EOL.MAIL_EOL; $message=''; } if(empty($reply)) $reply=$from; $recipients = explode(',', $to); $prijemci=array(); if(strpos($from,"<")===false) $odesilatel=array("jmeno"=>"","email"=>trim($from)); else list($odesilatel["jmeno"],$odesilatel["email"])=explode("<",str_replace(">","",$from)); if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", trim($odesilatel["email"]))) { error_log("Sending mail from ".$odesilatel["email"]."; subject: ".$subject." .... wrong FROM mail address."); return false; } foreach($recipients as $to) { if(strpos($to,"<")===false) $prijemce=array("jmeno"=>"","email"=>trim($to)); else list($prijemce["jmeno"],$prijemce["email"])=explode("<",str_replace(">","",$to)); if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", trim($prijemce["email"]))) { error_log("Sending mail from ".$odesilatel["email"]." to ".$prijemce["email"]."; subject: ".$subject." .... wrong TO mail address."); } else { list($prefix, $domain) = split("@",$prijemce["email"]); if(!empty($domain)) $prijemci[$domain][]=$prijemce; } } foreach($prijemci as $domain => $domain_to) { $socket=false; foreach($domain_to as $to_id=>$prijemce) { $error=0; do { if(($socket || $socket=mail_connect_domain_mx($domain,$helo)) && mail_server_cmd($socket, 'MAIL FROM: <'.$odesilatel["email"].'>') && mail_server_cmd($socket, 'RCPT TO: <'.$prijemce["email"].'>') && mail_server_cmd($socket, 'DATA') && mail_server_cmd($socket, "Date: ".date("r")."\r\nSubject: =?utf-8?B?".base64_encode($subject)."?=\r\nFrom: ".$odesilatel["jmeno"]." <".$odesilatel["email"].">\r\nTo: ".$prijemce["jmeno"]." <".$prijemce["email"].">\r\nReply-To: ".$reply."\r\n".$headers.$message."\r\n.") ) error_log("Sent mail from: ".$odesilatel["email"]." to:".$prijemce["email"]); elseif($socket) { mail_server_cmd($socket, 'QUIT'); fclose($socket); $socket=false; $error++; sleep(1); } } while($error==1); } if($socket) { mail_server_cmd($socket, 'QUIT'); fclose($socket); } } return true; } function mail_connect_domain_mx($domain,$helo='rb.npx.cz') { $mx_records=$mx_weight=$smtpServers=$mxs=array(); getmxrr($domain, $mx_records, $mx_weight); for($i=0;$i no response.'); return false; } if(in_array($server_response[0],array("2","3"))) return true; error_log('SMTP: '.$cmd.' => ERROR: '.trim($server_response)); return false; } ?>