Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define( '_JEXEC', 1 );
- define( '_VALID_MOS', 1 );
- define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../..'));
- define( 'DS', DIRECTORY_SEPARATOR );
- define( 'kompleks', 1);
- require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
- require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
- $mainframe =& JFactory::getApplication('site');
- $mainframe->initialise();
- $module = JModuleHelper::getModule('mod_feedbackform');
- $headLineParams = new JRegistry($module->params);
- $email = (string) $headLineParams['email'];
- $keys = array
- (
- 'fio' => 'ФИО',
- 'phone' => 'Телефон',
- 'email' => 'Email',
- );
- if(!isset($_POST['data']) || empty($_POST['data']))
- {
- JError::raiseWarning(500, '');
- exit;
- }
- else
- {
- $data = $_POST['data'];
- $html = '';
- foreach($data as $key => $value)
- {
- if(!isset($keys[$key]) || empty($value))
- {
- continue;
- }
- $html .= '<p><strong>'.$keys[$key].'</strong>: '.$value.'</p>';
- }
- $html .= '<p>---------------------------------<br>Это письмо сгенерировано автоматически и ответа не требует</p>';
- require dirname(__FILE__).'/../../third_parties/PHPMailer-master/PHPMailerAutoload.php';
- $to = explode(',', $email);
- $mail = new PHPMailer();
- $mail->isSMTP();
- $mail->CharSet = 'UTF-8';
- $mail->Host = 'smtp.gmail.com';
- $mail->Port = 587;
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = 'tls';
- $mail->Username = 'ecmasending@gmail.com';
- $mail->Password = 'ecma_22sending';
- $mail->setFrom('ecmasending@gmail.com', 'Cms Informer');
- foreach($to as $elem)
- {
- $mail->addAddress($elem);
- }
- $mail->Subject = 'Заявка с сайта';
- $mail->msgHTML($html);
- $mail->AltBody = strip_tags($html);
- $mail->send();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement