Advertisement
Guest User

Untitled

a guest
May 30th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. <?php
  2. define( '_JEXEC', 1 );
  3. define( '_VALID_MOS', 1 );
  4. define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../..'));
  5. define( 'DS', DIRECTORY_SEPARATOR );
  6. define( 'kompleks', 1);
  7.  
  8. require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
  9. require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
  10.  
  11. $mainframe =& JFactory::getApplication('site');
  12. $mainframe->initialise();
  13.  
  14. $module = JModuleHelper::getModule('mod_feedbackform');
  15. $headLineParams = new JRegistry($module->params);
  16. $email = (string) $headLineParams['email'];
  17.  
  18. $keys = array
  19. (
  20. 'fio' => 'ФИО',
  21. 'phone' => 'Телефон',
  22. 'email' => 'Email',
  23. );
  24.  
  25. if(!isset($_POST['data']) || empty($_POST['data']))
  26. {
  27. JError::raiseWarning(500, '');
  28. exit;
  29. }
  30. else
  31. {
  32. $data = $_POST['data'];
  33. $html = '';
  34. foreach($data as $key => $value)
  35. {
  36. if(!isset($keys[$key]) || empty($value))
  37. {
  38. continue;
  39. }
  40.  
  41. $html .= '<p><strong>'.$keys[$key].'</strong>: '.$value.'</p>';
  42. }
  43. $html .= '<p>---------------------------------<br>Это письмо сгенерировано автоматически и ответа не требует</p>';
  44.  
  45. require dirname(__FILE__).'/../../third_parties/PHPMailer-master/PHPMailerAutoload.php';
  46.  
  47. $to = explode(',', $email);
  48. $mail = new PHPMailer();
  49. $mail->isSMTP();
  50. $mail->CharSet = 'UTF-8';
  51. $mail->Host = 'smtp.gmail.com';
  52. $mail->Port = 587;
  53. $mail->SMTPAuth = true;
  54. $mail->SMTPSecure = 'tls';
  55.  
  56. $mail->Username = 'ecmasending@gmail.com';
  57. $mail->Password = 'ecma_22sending';
  58.  
  59. $mail->setFrom('ecmasending@gmail.com', 'Cms Informer');
  60. foreach($to as $elem)
  61. {
  62. $mail->addAddress($elem);
  63. }
  64.  
  65. $mail->Subject = 'Заявка с сайта';
  66. $mail->msgHTML($html);
  67. $mail->AltBody = strip_tags($html);
  68.  
  69. $mail->send();
  70. }
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement