Mam kod dzięki któremu z mojej strony można wysyłać formularz. Po wpisaniu danych pisze, że wiadomość wysłana, ale mail na mojego maila nie przychodzi ( wpisałem go w kodzie ). Co z tym nie tak ?
Kod
<?
// Autor skryptu: Aure Fos (aure@aurefos.net)
// Skrypt pobrany ze strony http://aurefos.net
// Poniższy kod wolno wykorzystywać na własny użytek oraz rozpowszechniać pod warunkiem zachowania informacji o autorze.
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
<title>Formularz kontaktowy</title>
<style>
body, td { font-size: 10px; font-family: Verdana; }
a:link,a:visited,a:active { text-decoration: none; color: #006600; }
a:hover { text-decoration: underline; }
input { font-size: 10px; font-family: Verdana; border: 1px solid #000000; }
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px; }
.small { font-size: 9px; }
.border { border: 1px solid #cccccc; }
.head { background-color: #f5f5f5; }
</style>
</head>
<body>
<?
//Konfiguracja
$send_to = 'mojemail@o2.pl'; //tutaj należy wstawić adres e-mail, pod który będą wysyłane wiadomości
$message_title_prefix = '[http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).' - Formularz kontaktowy]'; //prefiks jaki będzie dodawany do tytułu wiadomości, domyślnie jest to [http://yourdomain.com/script_path - Formularz kontaktowy]
if($_GET['a'] == 'send')
{
$sender = trim(strip_tags($_POST['sender']));
$sender_mail = trim(strip_tags($_POST['sender_mail']));
$message_title = trim(strip_tags($_POST['message_title']));
$message = trim(strip_tags($_POST['message']));
if(empty($sender) || empty($sender_mail) || empty($message_title) || empty($message)) $msg = 'ABANDON_FIELD';
else
{
$send = mail($send_to, $message_title_prefix.' '.$message_title, $message, "From: ".$sender_mail."\nReply-to: ".$sender_mail."\nContent-type: text/plain; charset=iso-8859-2\nContent-transfer-encoding: 8bit");
if($send) $msg = 'MAIL_SENT';
else $msg = 'MAIL_SENDING_FAILED';
}
}
?>
<table cellspacing="2" cellpadding="2" border="0">
<form action="mail.php?a=send" method="post">
<tr>
<td>Nick</td>
<td><input type="text" size="60" class="field" name="sender" value="<? echo $sender; ?>"></td>
</tr>
<tr>
<td>E-mail</td>
<td><input type="text" size="60" class="field" name="sender_mail" value="<? echo $sender_mail; ?>"></td>
</tr>
<tr>
<td>Tytuł wiadomości</td>
<td><input type="text" size="60" class="field" name="message_title" value="<? echo $message_title; ?>"></td>
</tr>
<tr>
<td valign="top">Treść wiadomości</td>
<td><textarea rows="8" cols="60" class="field" name="message"><? echo $message; ?></textarea><br><br><input type="submit" value="Wyślij" class="but"></td>
</tr>
</form>
</table><br />
<?
switch($msg)
{
case 'ABANDON_FIELD' :
echo '<b>Nie wypełniono wszystkich pól. Wiadomość nie została wysłana</b>';
break;
case 'MAIL_SENT' :
echo '<b>Wiadomość została wysłana.</b>';
break;
case 'MAIL_SENDING_FAILED' :
echo '<b>Wystąpił bład podczas wysyłania wiadomości. Wiadomość nie została wysłana.</b>';
break;
}
?>
</body>
</html>
// Autor skryptu: Aure Fos (aure@aurefos.net)
// Skrypt pobrany ze strony http://aurefos.net
// Poniższy kod wolno wykorzystywać na własny użytek oraz rozpowszechniać pod warunkiem zachowania informacji o autorze.
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
<title>Formularz kontaktowy</title>
<style>
body, td { font-size: 10px; font-family: Verdana; }
a:link,a:visited,a:active { text-decoration: none; color: #006600; }
a:hover { text-decoration: underline; }
input { font-size: 10px; font-family: Verdana; border: 1px solid #000000; }
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px; }
.small { font-size: 9px; }
.border { border: 1px solid #cccccc; }
.head { background-color: #f5f5f5; }
</style>
</head>
<body>
<?
//Konfiguracja
$send_to = 'mojemail@o2.pl'; //tutaj należy wstawić adres e-mail, pod który będą wysyłane wiadomości
$message_title_prefix = '[http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).' - Formularz kontaktowy]'; //prefiks jaki będzie dodawany do tytułu wiadomości, domyślnie jest to [http://yourdomain.com/script_path - Formularz kontaktowy]
if($_GET['a'] == 'send')
{
$sender = trim(strip_tags($_POST['sender']));
$sender_mail = trim(strip_tags($_POST['sender_mail']));
$message_title = trim(strip_tags($_POST['message_title']));
$message = trim(strip_tags($_POST['message']));
if(empty($sender) || empty($sender_mail) || empty($message_title) || empty($message)) $msg = 'ABANDON_FIELD';
else
{
$send = mail($send_to, $message_title_prefix.' '.$message_title, $message, "From: ".$sender_mail."\nReply-to: ".$sender_mail."\nContent-type: text/plain; charset=iso-8859-2\nContent-transfer-encoding: 8bit");
if($send) $msg = 'MAIL_SENT';
else $msg = 'MAIL_SENDING_FAILED';
}
}
?>
<table cellspacing="2" cellpadding="2" border="0">
<form action="mail.php?a=send" method="post">
<tr>
<td>Nick</td>
<td><input type="text" size="60" class="field" name="sender" value="<? echo $sender; ?>"></td>
</tr>
<tr>
<td>E-mail</td>
<td><input type="text" size="60" class="field" name="sender_mail" value="<? echo $sender_mail; ?>"></td>
</tr>
<tr>
<td>Tytuł wiadomości</td>
<td><input type="text" size="60" class="field" name="message_title" value="<? echo $message_title; ?>"></td>
</tr>
<tr>
<td valign="top">Treść wiadomości</td>
<td><textarea rows="8" cols="60" class="field" name="message"><? echo $message; ?></textarea><br><br><input type="submit" value="Wyślij" class="but"></td>
</tr>
</form>
</table><br />
<?
switch($msg)
{
case 'ABANDON_FIELD' :
echo '<b>Nie wypełniono wszystkich pól. Wiadomość nie została wysłana</b>';
break;
case 'MAIL_SENT' :
echo '<b>Wiadomość została wysłana.</b>';
break;
case 'MAIL_SENDING_FAILED' :
echo '<b>Wystąpił bład podczas wysyłania wiadomości. Wiadomość nie została wysłana.</b>';
break;
}
?>
</body>
</html>
dzieki