(☞ຈل͜ຈ)☞ Главная  Статьи  Загрузчик Домой

Ok!
Ok!
100
<?if($_REQUEST) {
	if ( htmlspecialchars( $_REQUEST['mail'], 3 ) != ''
	     && strpos( htmlspecialchars( $_REQUEST['mail'], 3 ), '@' ) != false
	) {
		$to = '[email protected]'; 
		$to2 .= htmlspecialchars( $_REQUEST['mail'] );
		$subject  = 'Сообщение с сайта' . $_SERVER['HTTP_HOST'];
		$subject2 = 'Ваше сообщение на сайт ' . $_SERVER['HTTP_HOST'];
		$message = '
<html>
<head>
  <title>Сообщение с сайта ' . $_SERVER['HTTP_HOST'] . '</title>
</head>
<body>
  <p>С сайта отправлено соощение:</p>
  <table cellpadding=10>
    <tr>
      <th style="background-color:#ccc; color:white">Имя</th><th style="background-color:#ccc; color:white">Почта</th><th style="background-color:#ccc; color:white">Дата</th><th style="background-color:#ccc; color:white">Время</th>
    </tr>
    <tr>
      <td>' . htmlspecialchars( $_REQUEST['name'],3 ) . '</td><td>' . htmlspecialchars( $_REQUEST['mail'],3 ) . '</td><td>' .
		           date( 'd-m-Y' ) . '</td><td>' . date( 'H:s' ) . '</td>
    </tr>
    <tr>
      <td colspan=4>' . htmlspecialchars( $_REQUEST['text'],3 ) . '</td>
    </tr>
  </table>
</body>
</html>
';
$message2 = '
<html>
<head>
  <title>Сообщение с сайта' . $_SERVER['HTTP_HOST'] . '</title>
</head>
<body>
  <p>Вы отправили сообщение на сайт ' . $_SERVER['HTTP_HOST'] . '. С вами свяжутся в ближайшее время, спасибо.</p>
  
</body>
</html>
';


		$headers = 'MIME-Version: 1.0' . "
";
		$headers .= 'Content-type: text/html; charset=utf-8' . "
";
		$headers .= 'To: Admin <' . $to . '>' . "
";
		$headers .= 'From: Reglass <' . $to . '>' . "
";
		$headers2 = 'MIME-Version: 1.0' . "
";
		$headers2 .= 'Content-type: text/html; charset=utf-8' . "
";
		$headers2 .= 'To: ' . htmlspecialchars( $_REQUEST['name'] ) . ' <' . htmlspecialchars( $_REQUEST['mail'] ) . '>' . "
";
		$headers2 .= 'From: Reglass <' . $to . '>' . "
";


		if($y = mail( $to, $subject, $message, $headers )
		&& $y2 = mail( $to2, $subject2, $message2, $headers2 )) {
			echo '<script>alert(Спасибо. Сообщение отправлено.); document.location="/"</script>';
		}
	}
}
?>
php, mail230Отправка письма php
1 2 3 4 5 6 7 8 9 10 11 12 13