|
|
|
| помоиогите с формы нужно отправить данные на почту mail.ru | |
|
|
|
|
|
|
|
для: pernik
(20.02.2011 в 03:58)
| | а как скрипт выполняется локально или на сервере? | |
|
|
|
|
|
|
|
для: lightning.say
(20.02.2011 в 06:40)
| |
$addres = "blablabla@mail.ru";
$subgect = "тема";
$message = "появился коментарий к заметке " .$post_title."\n комментарий добавил(а) ".$author. "\n текст комментария
".$text."\n ссылка на комментарий http://localhost/phpblog/view_post.php?id=".$id."";
mail ($addres,$subgect,$message,"Content-type:text/plain; Charset=windows-1251\r\n");
|
если локально то ищи в webserver\tmp\!sendmail если в инете то придет на почту | |
|
|
|
|
|
|
|
для: pernik
(20.02.2011 в 03:58)
| |
<br>
<form action="fake_mail.php" method="POST">
<table>
<tr>
<td>Кому:</td>
<td><input type="text" name="to" size=30 id="to" style="color:yellow; background:blue;" /><td>
</tr>
<tr>
<td>Від кого:</td>
<td><input type="text" name="from_who" size=30 id="from_who" style="color:blue; background:yellow;" />
</tr>
<tr>
<td>Ім"я:</td>
<td><input type="text" name="from_name" size=30 id="from_name" style="color:red; background:lightgrey;" />
</tr>
<tr>
<td>Тема:</td>
<td><input type="text" name="subject" size=66 id="subject" style="color:red; background: lightgrey;" />
</tr>
<tr>
<td valign="top">Месідж:</td>
<td><textarea cols=50 rows=15 name="message" id="message" style="color:red; background: lightgrey; line-height:12px;"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Відправити" style="color:brown; background: lightblue;" /></td>
</tr>
</table>
</form>
<?php
require ('functions.php');
if (isset($_POST['to']) || isset($_POST['from_mail']) || isset($_POST['subject']) || isset($_POST['message']) || isset($_POST['from_name'])){
$to= cleanUP($_POST['to']);
$from_mail= cleanUP($_POST['from_who']);
$subject= cleanUP($_POST['subject']);
$message= cleanUp($_POST['message']);
$from_name = cleanUp($_POST['from_name']);
$priority = 1; /* 1 -3 */
$body = "$message\n";
$from = "$from_name <$from_mail>";
$headers = "Content-Type: text/html; charset=windows-1251\n";
$headers .= "From: $from\n";
$headers .= "X-Mailer: The Bat! 2005\n";
$headers .= "X-Priority: $priority\n";
if (empty($to) || empty($from_mail) || empty($subject) || empty($message) || empty($from_name))
{echo "<font color=red><b>Помилка , перевірте, чи заповненні всі поля?</b></font><br><br>";}
else
{
echo "<font color=red><b>Ваш лист відправленно!</b></font><br><br>";
/*ОТПРАВКА ПИЬСМА*/
mail($to,$subject,$body,$headers);}
#echo "<pre>";
#echo print_r($_POST);
#echo "</pre>";
}
else
{echo "<font color=brown><b>Введіть потрібні дані у відповідні поля.</b></font><br><br>";}
?>
|
Где functions.php :
<?php
function cleanUp($data) {
$data = strip_tags(htmlspecialchars($data));
return $data;
}
?>
|
| |
|
|
|