Mam mały problem z formularzem wysyłającym wiadomość na maila wykorzystującym funkcję mail(). Formularz działą mi niby dobrze i jak sprawdzam pocztę na serwerze cba.pl to wyświetla się tak jak powinien, jednak w outlooku cały nagłówek maila wyświetlany jest w wiadomości wygląda to tak:
From: Nazwisko < email@gmail.com >
Message-Id: <20100301100048.3D375BC07B@werewolf.cba.pl>
Date: Mon, 1 Mar 2010 11:00:48 +0100 (CET)
Imie: Imię
Nazwisko: Nazwisko
Zawod: Zawód
Email: email@gmail.com
Reklamy: checked
poniżej przedstawiam kod php
Kod
<?php
if (count($_POST))
{
////////// USTAWIENIA //////////
$email = 'office@mariusz198406.cba.pl'; // Adres e-mail adresata
$subject = 'temat'; // Temat listu
$message = 'Dziękujemy za wysłanie formularza'; // Komunikat
$error = 'Wystąpił błąd podczas wysyłania formularza'; // 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";
$head = "From: $_POST[Imię] $_POST[Nazwisko] < $_POST[Email] >";
$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
{
?>
if (count($_POST))
{
////////// USTAWIENIA //////////
$email = 'office@mariusz198406.cba.pl'; // Adres e-mail adresata
$subject = 'temat'; // Temat listu
$message = 'Dziękujemy za wysłanie formularza'; // Komunikat
$error = 'Wystąpił błąd podczas wysyłania formularza'; // 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";
$head = "From: $_POST[Imię] $_POST[Nazwisko] < $_POST[Email] >";
$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
{
?>
Jeżeli macie pomysł co robię źle to proszę napiszcie
Pozdrawiam