Advertisement
zero50x

Форма с PHPMailer

Apr 7th, 2014
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <?php
  2.  
  3. require_once ('./lib/phpmailer2/class.phpmailer.php');
  4.  
  5. if (isset($_POST['ok']))
  6.     {
  7.     //если существует переменная, значит начнем получать информацию из формы
  8.     $fio=$_POST['fio'];
  9.     $tel=$_POST['tel'];
  10.     $text=$_POST['text'];
  11.     }
  12.    
  13. //mail('maksim.bizinkin.82z@mail.ru', 'Content-type:text/plain; charset=utf-8', 'сообщение с сайта', $text."\n".$fio."\n".$tel);
  14.  
  15. $mailer = new PHPMailer();
  16. $mailer->IsSMTP();
  17. $mailer->CharSet = 'UTF-8';
  18. $mailer->Mailer   = "smtp";
  19. $mailer->addCustomHeader("Precedence: bulk");
  20. $mailer->Host       = "smtp.yandex.ru";
  21. $mailer->SMTPDebug  = "1";
  22. $mailer->SMTPAuth   = "true";
  23. $mailer->Port       = "25";
  24. $mailer->Username   = "coolpage5@yandex.ru";
  25. $mailer->Password   = "мой пароль";
  26. $mailer->From = 'coolpage5@yandex.ru';
  27. $mailer->FromName = 'coolpage5@yandex.ru';
  28.    
  29. $mailer->Subject = 'сообщение с сайта';
  30. $mailer->AddAddress('maksim.bizinkin.82z@mail.ru');
  31. $mailer->AddAddress('daemon@email.ua');
  32.  
  33. $mailer->IsHTML(true);                         
  34.        
  35. $mailer->Body = $text."\n".$fio."\n".$tel;
  36.        
  37. @$mailer->Send();
  38.  
  39.  
  40. ?>
  41.  
  42.  
  43.  
  44. <form method="post" action="sendmail.php">
  45. ФИО: <input name="fio" type="text" />
  46. <br />
  47. Телефон: <input name="tel" type="text" />
  48. <br />
  49. <textarea name="text">Введите текст</textarea>
  50. <br />
  51. <input type="submit" name="ok" value="Отправить" />
  52. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement