<?php
if (count($_POST))
{

	$email = 'dk.modlitwy@gmail.com' ;
	$subject = 'Skrzynka intencji';
	$message = 'Dziękujemy za wysłanie intencji';	// Komunikat
	$error = 'Wystąpił błąd podczas wysyłania';	// Komunikat błędu
	$charset = 'iso-8859-2';	// Strona kodowa
	//////////////////////////////

	$head =
		"MIME-Version: 1.0\r\n" .
		"Content-Type: text/plain; charset=$charset\r\n" .
		"Content-Transfer-Encoding: 8bit";
	$body = '';
	foreach ($_POST as $name => $value)
	{
		if (is_array($value))
		{
			for ($i = 0; $i < count($value); $i++)
			{
				$body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
			}
		}
		else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
	}
	echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
}
else
{
?>
<body bgcolor="#D6F8C0">
<form action="?" method="post" bgcolor="#D6F8C0">



          <p>twoja intencja:<br>
          <textarea name="wpis" rows="12" cols="40"></textarea></p>
          <p>podpis:<br>

          <input type="text" size="35" maxlength="50" name="podpis" value=""></p>
          <p>e-mail:<br>
          <input type="text" size="35" maxlength="50" name="email" value=""></p>
          <p><input type="submit" name="Submit" value="    Proszę o modlitwę    "></p>



</form>
</body>
<?php
}
?>
