<?php
	for($i = 0; $i < count($_POST); $i++):
		${key($_POST)} = $_POST[key($_POST)];
		next($_POST);		
	endfor;
	
	# -=-=-=- MIME BOUNDARY

	$mime_boundary = "----Poklon----".md5(time());
	
	# -=-=-=- MAIL HEADERS
	
	$to = "sosa@fruvita.com";
	

	$headers .= "MIME-Version: 1.0\n";
	$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
	$subject = "Poruka sa sajta SOSA";
	# -=-=-=- HTML EMAIL PART
	 
	$mailmessage .= "--$mime_boundary\n";
	$mailmessage .= "Content-Type: text/html; charset=utf-8\n";
	$mailmessage .= "Content-Transfer-Encoding: 8bit\n\n";
	$mailmessage .= "<html>\n";
	$mailmessage .= "<body style=\"font-family:Trebuchet MS, sans-serif; font-size:12px; color:#000;\">\n";
	$mailmessage .= "Poruka sa sajta Sosa:<br/>\n";
	$mailmessage .= "<br/>\n";
	$mailmessage .= "<br/>\n";
	$mailmessage .= "$poruka<br/>\n";
	$mailmessage .= "<br/>\n";
	$mailmessage .= "$ime<br/>\n";	
	$mailmessage .= "<br/>\n";
	$mailmessage .= "$adresa<br/>\n";
	$mailmessage .= "<br/>\n";
	$mailmessage .= "</body>\n";
	$mailmessage .= "</html>\n";
	
	if(mail($to, $subject, $mailmessage, $headers))
		header('location:../pitaj-sosu.php?mail=sent');

	else
		header('location:../pitaj-sosu.php?mail=error');

?>