Guest User

Untitled

a guest
Apr 20th, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.98 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @param $mQuery
  4.  * @return mixed
  5.  */
  6. // function clearQuery($mQuery)
  7. // {
  8. //     if (is_array($mQuery)) {
  9. //         $aNewQuery = array();
  10. //         foreach ($mQuery as $sKey => $sQuery) {
  11. //             $aNewQuery[$sKey] = clearQuery($sQuery);
  12. //         }
  13. //         return $aNewQuery;
  14. //     } else {
  15. //         $sNewQuery = trim(htmlentities(trim($mQuery)));
  16. //         return $sNewQuery;
  17. //     }
  18. // }
  19.  
  20. // $text = "";
  21. // $to = '[email protected]';
  22. // $subject = 'Заявка с лендинга hiconversion.ru';
  23.  
  24. // $aCleanPost = clearQuery($_POST);
  25.  
  26. // if (!empty($aCleanPost["name"])) {
  27. //     $text .= "Имя: " . $aCleanPost["name"] . '<br/>';
  28. // }
  29.  
  30. // if (!empty($aCleanPost["phone"])) {
  31. //     $text .= "Контакты: " . $aCleanPost["phone"] . '<br/>';
  32. // }
  33. // if (!empty($aCleanPost["email"])) {
  34. //     $text .= "Email: " . $aCleanPost["email"] . '<br/>';
  35. // }
  36. // if (!empty($aCleanPost["utm_info"])) {
  37. //     $text .= "<br/><br/>Дополнительная информация о клиенте:<br/>" . $aCleanPost["utm_info"];
  38. // }
  39. // if (!empty($aCleanPost["utm_referrer"])) {
  40. //     $text .= "<br/>Клиент перешел с сайта:<br/>" . $aCleanPost["utm_referrer"];
  41. // }
  42.  
  43.  
  44. // $headers = "MIME-Version: 1.0\r\n";
  45. // $headers .= "Content-type: text/html; charset=utf-8\r\n";
  46. // $headers .= "From: Hiconversion <[email protected]>\r\n";
  47. // $headers .= 'Bcc: [email protected], [email protected]' . "\r\n";
  48. // //$headers .= 'Bcc: [email protected]' . "\r\n";
  49.  
  50. // $res = mail($to, $subject, $text, $headers);
  51.  
  52.     // $parse_uri = explode('wp-content', $_SERVER['SCRIPT_FILENAME']);
  53.     // require_once($parse_uri[0] . 'wp-load.php');
  54.  
  55.     $text="";
  56. //  $to = "[email protected]";
  57.     $subject = 'Заявка c лендинга';
  58.  
  59.     if ( (empty($_POST["email"]))&& (empty($_POST["name"]))){
  60.         echo "пустой запрос";
  61.         die();
  62.     }
  63.  
  64.     if (!empty($_POST["type"])){
  65.         $text.="Тип заявки: ".$_POST["type"].'<br/>';
  66.     }
  67.     if (!empty($_POST["name"])){
  68.         $text.="Имя: ".$_POST["name"].'<br/>';
  69.     }
  70.     if (!empty($_POST["phone"])){
  71.         $text.="Контакты: ".$_POST["phone"].'<br/>';
  72.     }
  73.     if (!empty($_POST["email"])){
  74.         $text.="Email: ".$_POST["email"].'<br/>';
  75.     }  
  76.     if (!empty($_POST["city"])){
  77.         $text.="Город: ".$_POST["city"].'<br/>';
  78.     }
  79.     if (!empty($_POST["utm_info"])){
  80.         $text .= "<br/><br/>Дополнительная информация о клиенте:<br/>".$_POST["utm_info"];
  81.     }
  82.     if (!empty($_POST["utm_referrer"])){
  83.         $text .= "<br/>Клиент перешел с сайта:<br/>".$_POST["utm_referrer"];
  84.     }
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.     require 'PHPMailer-master/PHPMailerAutoload.php';
  96.     $mail = new PHPMailer;
  97.  
  98.     //$mail->SMTPDebug = 3;                               // Enable verbose debug output
  99.     $mail->CharSet = 'UTF-8';
  100.     $mail->setLanguage('ru');
  101.    
  102.     $mail->isSMTP();                                      // Set mailer to use SMTP
  103.     //$mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
  104.     $mail->Host = 'smtp.yandex.ru';  // Specify main and backup SMTP servers
  105.     $mail->SMTPAuth = true;                               // Enable SMTP authentication
  106.     //$mail->Username = '[email protected]';                 // SMTP username
  107.     $mail->Username = '[email protected]';                 // SMTP username
  108.     $mail->Password = 'e3ecc75169';                           // SMTP password
  109.     $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
  110.     $mail->Port = 587;                                    // TCP port to connect to
  111.    
  112.     //$mail->From = '[email protected]';
  113.     //$mail->From = '[email protected]';
  114.     $mail->From = '[email protected]';
  115.     $mail->FromName = 'Hiconversion';
  116.     $addresses = explode(',', $to);
  117.     foreach($addresses as $address) {
  118.         $mail->addAddress($address);     // Add a recipient
  119.     }
  120.  
  121.     $mail->AddBCC("[email protected]");
  122.     $mail->AddBCC("[email protected]");
  123.     //$mail->addAddress('[email protected]');     // Add a recipient
  124.     //$mail->addAddress('[email protected]');     // Add a recipient
  125.     //$mail->addReplyTo('[email protected]', 'Hiconversion');
  126.  
  127.     $mail->WordWrap = 50;                                 // Set word wrap to 50 characters
  128.     $mail->isHTML(true);                                  // Set email format to HTML
  129.  
  130.     $mail->Subject = $subject;
  131.     $mail->Body    = $text;
  132.     $mail->AltBody = $text;
  133.  
  134.     if(!$mail->send()) {
  135.         echo 'Message could not be sent.';
  136.         echo 'Mailer Error: ' . $mail->ErrorInfo . ' ' . $to;
  137.     } else {
  138.         echo 'Message has been sent to ' . $to;
  139.     }  
  140.  
  141.     // if (!empty($_POST["email"]) && !empty($_POST["type"]) && strcmp($_POST["type"], "catalog") == 0) {
  142.     //     $mail = new PHPMailer;
  143.  
  144.     //     //$mail->SMTPDebug = 3;                               // Enable verbose debug output
  145.     //     $mail->CharSet = 'UTF-8';
  146.     //     $mail->setLanguage('ru');
  147.        
  148.     //     $mail->isSMTP();                                      // Set mailer to use SMTP
  149.     //     $mail->Host = 'smtp.yandex.ru';  // Specify main and backup SMTP servers
  150.     //     $mail->SMTPAuth = true;                               // Enable SMTP authentication
  151.     //     $mail->Username = '[email protected]';                 // SMTP username
  152.     //     $mail->Password = 'kUq4yK';                           // SMTP password
  153.     //     $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
  154.     //     $mail->Port = 587;                                    // TCP port to connect to
  155.        
  156.     //     $mail->From = '[email protected]';
  157.     //     $mail->FromName = 'Vereteno';
  158.     //     $addresses = explode(',', $to);
  159.     //     $mail->addAddress($_POST["email"]);
  160.  
  161.     //     $mail->WordWrap = 50;                                 // Set word wrap to 50 characters
  162.     //     $mail->isHTML(true);                                  // Set email format to HTML
  163.  
  164.     //     $mail->Subject = "Ссылка на скачивание каталога Веретено.";
  165.     //     $mail->Body    = 'Здравствуйте, ваша ссылка на скачивание каталога: <a href="http://opt.vereteno-fashion.ru/uploads/catalog.pdf">catalog.pdf</a> .' . '<br/>' .
  166.     //         'С уважением, команда Веретено!';
  167.  
  168.     //     if(!$mail->send()) {
  169.     //         echo 'Message client could not be sent.';
  170.     //         echo 'Mailer Error: ' . $mail->ErrorInfo . ' ' . $to;
  171.     //     } else {
  172.     //         echo 'Message client  has been sent to ' . $_POST["email"];
  173.     //     }  
  174.     // }
  175. ?>
Advertisement
Add Comment
Please, Sign In to add comment