<?
		error_reporting(E_ALL);
		//error_reporting(E_ERROR | E_WARNING | E_PARSE);
		ini_set('display_errors', '1');
		
		
		function posalji_email($prima, $subjekt, $tekst,
				$salje_ime = 'Miroslav Alkovic',
				$salje_email = 'miroslav.alkovic@gmail.com',
				$bcc = '', 
				$html = 0){
			
			$headers = "";
			
			if($html){
				$headers  = "MIME-Version: 1.0\n";
				$headers .= "Content-type: text/html; charset=windows-1250\n";
			}
	
			$headers .= "From: $salje_ime <$salje_email>";
			if($bcc){
				$headers .= "\nBcc: ".$bcc;
			}
			
			$result = mail($prima, $subjekt, $tekst, $headers);
			return $result;
		}
		
		
	function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message, $bcc = '', $print_msg = '') { 
		$file = $path.$filename;
		$file_size = filesize($file); 
		$handle = fopen($file, "r"); 
		$content = fread($handle, $file_size); 
		fclose($handle); 
		$content = chunk_split(base64_encode($content)); 
		$uid = md5(uniqid(time())); 
		$name = basename($file); 
		$header = "From: ".$from_name." <".$from_mail.">\n"; 
		if($bcc){
			$header .= "Bcc: ".$bcc."\n";
		}
		$header .= "Reply-To: ".$replyto."\n"; 
		$header .= "MIME-Version: 1.0\n"; 
		$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\n\n"; 
		$header .= "This is a multi-part message in MIME format.\n"; 
		$header .= "--".$uid."\n"; 
		$header .= "Content-type:text/html; charset=windows-1250\n"; 
		$header .= "Content-Transfer-Encoding: 7bit\n\n"; 
		$header .= $message."\n\n"; 
		$header .= "--".$uid."\n"; 
		$header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\n"; // use diff. tyoes here 
		$header .= "Content-Transfer-Encoding: base64\n"; 
		$header .= "Content-Disposition: attachment; filename=\"".$filename."\"\n\n"; 
		$header .= $content."\n\n"; 
		$header .= "--".$uid."--"; 
		
		if (mail($mailto, $subject, "", $header)) { 
			if($print_msg){
				echo "E-mail je poslan! "; // or use booleans here 
			}
		} else { 
			if($print_msg){
				echo "error "; 
			}
		} 
	}
		
	
		print '1';
		
		//$x = posalji_email('info@infoizlog.com', 'test email', 'ovo je poruka za slanje');
		
		mail_attachment('zdravlje-kvizovi-home.jpg', 'C:\Apache\htdocs\fiskal-x\svn-server\ugo-web/app/webroot/iso/cron/',
			'info@infoizlog.com', 'fiskalx2000@gmail.com', 'FiskalX', 'fiskalx2000@gmail.com', 'test poruka12', 
			'ovo je poruka za slanje s privitkom, a trenutno i testiram slanje...', '', 1);
		
		print '2';
		
		//print $x;
		
		exit;
		

?>