public function ajaxProcessSendMailTest() { if ($this->tabAccess['view'] === '1') { $smtpChecked = trim(Tools::getValue('mailMethod')) == 'smtp'; $smtpServer = Tools::getValue('smtpSrv'); $content = urldecode(Tools::getValue('testMsg')); $content = utf8_encode(html_entity_decode($content)); $subject = urldecode(Tools::getValue('testSubject')); $type = 'text/html'; $to = Tools::getValue('testEmail'); $from = Configuration::get('PS_SHOP_EMAIL'); $smtpLogin = Tools::getValue('smtpLogin'); $smtpPassword = Tools::getValue('smtpPassword'); $smtpPassword = !empty($smtpPassword) ? urldecode($smtpPassword) : Configuration::get('PS_MAIL_PASSWD'); $smtpPort = Tools::getValue('smtpPort'); $smtpEncryption = Tools::getValue('smtpEnc'); $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption)); die($result === true ? 'ok' : $result); } }
* @author Dream me up * @copyright 2011 Mailjet SAS * @license hhttp://opensource.org/licenses/mit-license MIT License * International Registred Trademark & Property of Mailjet SAS */ require '../../config/config.inc.php'; require 'mailjet.php'; if (Tools::getValue('token') == '' || Tools::getValue('token') != Configuration::get('MAILJET_AJAX_TOKEN')) { die('Invalid Token'); } $obj_mailjet = new Mailjet(); $email_from = urldecode($_GET['email_from']); try { $sujet = $obj_mailjet->l('Mailjet Test E-mail'); $message = $obj_mailjet->l('Hello') . ",\r\n\r\n" . $obj_mailjet->l('This E-mail confirms you that Mailjet has successfully been installed on your shop.'); $result = Mail::sendMailTest(true, "in.mailjet.com", $message, $sujet, "text/plain", $email_from, $email_from, $_GET['mailjet_api_key'], $_GET['mailjet_secret_key'], $smtpPort = 465, "tls"); if ($result === true) { echo "true"; } else { if ($result == 999) { $result = $obj_mailjet->l('The E-mail was not successfully sent'); } echo "false|" . $result; reset_config_mailjet(); } } catch (Exception $e) { echo "false|" . $e->getMessage(); reset_config_mailjet(); } function reset_config_mailjet() {
* If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <*****@*****.**> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ include_once dirname(__FILE__) . '/../config/config.inc.php'; /* Getting cookie or logout */ require_once dirname(__FILE__) . '/init.php'; $smtpChecked = trim($_POST['mailMethod']) == 'smtp'; $smtpServer = $_POST['smtpSrv']; $content = urldecode($_POST['testMsg']); $subject = urldecode($_POST['testSubject']); $type = 'text/html'; $to = $_POST['testEmail']; $from = Configuration::get('PS_SHOP_EMAIL'); $smtpLogin = $_POST['smtpLogin']; $smtpPassword = urldecode($_POST['smtpPassword']); $smtpPort = $_POST['smtpPort']; $smtpEncryption = $_POST['smtpEnc']; $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption)); die($result === true ? 'ok' : $result);
public function ajaxProcessSendMailTest() { /* PrestaShop demo mode */ if (_PS_MODE_DEMO_) { die(Tools::displayError('This functionality has been disabled.')); } /* PrestaShop demo mode */ if ($this->tabAccess['view'] === '1') { $smtpChecked = trim(Tools::getValue('mailMethod')) == 'smtp'; $smtpServer = Tools::getValue('smtpSrv'); $content = urldecode(Tools::getValue('testMsg')); $content = html_entity_decode($content); $subject = urldecode(Tools::getValue('testSubject')); $type = 'text/html'; $to = Tools::getValue('testEmail'); $from = Configuration::get('PS_SHOP_EMAIL'); $smtpLogin = Tools::getValue('smtpLogin'); $smtpPassword = Tools::getValue('smtpPassword'); $smtpPassword = !empty($smtpPassword) ? urldecode($smtpPassword) : Configuration::get('PS_MAIL_PASSWD'); $smtpPassword = str_replace(array('<', '>', '"', '&'), array('<', '>', '"', '&'), Tools::htmlentitiesUTF8($smtpPassword)); $smtpPort = Tools::getValue('smtpPort'); $smtpEncryption = Tools::getValue('smtpEnc'); $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), $smtpPassword, Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption)); die($result === true ? 'ok' : $result); } }
<?php include_once dirname(__FILE__) . '/../config/config.inc.php'; /* Getting cookie or logout */ require_once dirname(__FILE__) . '/init.php'; $smtpChecked = trim($_GET['mailMethod']) == 'smtp'; $smtpServer = $_GET['smtpSrv']; $content = $_GET['testMsg']; $subject = $_GET['testSubject']; $type = 'text/html'; $to = $_GET['testEmail']; $from = 'no-reply@' . Tools::getHttpHost(false, true) . '.com'; $smtpLogin = $_GET['smtpLogin']; $smtpPassword = $_GET['smtpPassword']; $smtpPort = $_GET['smtpPort']; $smtpEncryption = $_GET['smtpEnc']; $result = Mail::sendMailTest($smtpChecked, $smtpServer, $content, $subject, $type, $to, $from, $smtpLogin, $smtpPassword, $smtpPort, $smtpEncryption); die($result ? 'ok' : 'fail');
private function _postProcessConfiguration() { $employee = new Employee((int) Context::getContext()->cookie->id_employee); Configuration::updateValue('MAILJET_API_KEY', pSQL(Tools::getValue('mailjet_api_key'))); Configuration::updateValue('MAILJET_SECRET_KEY', pSQL(Tools::getValue('mailjet_secret_key'))); // If mailjet activation, let's configure if ((int) Tools::getValue('mailjet_activation') == 1) { // Test multiple configuration $configTab = array(array('server' => 'in.mailjet.com', 'port' => 465, 'protocol' => 'tls'), array('server' => 'in.mailjet.com', 'port' => 465, 'protocol' => 'ssl'), array('server' => 'in.mailjet.com', 'port' => 587, 'protocol' => 'tcp'), array('server' => 'in-v4.mailjet.com', 'port' => 465, 'protocol' => 'ssl'), array('server' => 'in-v4.mailjet.com', 'port' => 588, 'protocol' => 'tcp')); $result = false; $email = $employee->email; $subject = $this->l('Mailjet Test E-mail'); $message = $this->l('Hello') . ",\r\n\r\n" . $this->l('This E-mail confirms you that Mailjet has successfully been installed on your shop.'); foreach ($configTab as $config) { if ($result !== true) { $result = Mail::sendMailTest(true, $config['server'], $message, $subject, "text/plain", $email, $email, Configuration::get('MAILJET_API_KEY'), Configuration::get('MAILJET_SECRET_KEY'), $config['port'], $config['protocol']); if ($result === true) { Configuration::updateValue('MAILJET_ACTIVATE', (int) Tools::getValue('mailjet_activation')); Configuration::updateValue('PS_MAIL_METHOD', 2); Configuration::updateValue('PS_MAIL_SERVER', pSQL($config['server'])); Configuration::updateValue('PS_MAIL_USER', pSQL(Configuration::get('MAILJET_API_KEY'))); Configuration::updateValue('PS_MAIL_PASSWD', pSQL(Configuration::get('MAILJET_SECRET_KEY'))); Configuration::updateValue('PS_MAIL_SMTP_ENCRYPTION', pSQL($config['protocol'])); Configuration::updateValue('PS_MAIL_SMTP_PORT', pSQL($config['port'])); $this->_html .= $this->displayConfirmation($this->l('Settings updated')); } } } if ($result !== true) { $this->_html .= $this->displayError($this->l('Settings failed')); } } else { Configuration::updateValue('PS_MAIL_METHOD', 1); Configuration::updateValue('PS_MAIL_SERVER', ""); Configuration::updateValue('PS_MAIL_USER', ""); Configuration::updateValue('PS_MAIL_PASSWD', ""); Configuration::updateValue('PS_MAIL_SMTP_ENCRYPTION', ""); Configuration::updateValue('PS_MAIL_SMTP_PORT', 25); } }
function smcf_send($name, $phone, $subject, $message, $cc) { include_once _PS_SWIFT_DIR_ . 'Swift.php'; // Filter and validate fields $name = $this->smcf_filter($name); $subject = $this->smcf_filter($subject); $phone = $this->smcf_filter($phone); if (!$this->smcf_validate_phone($phone)) { $subject .= " - Warning!: CALL-BACK!"; $message .= "\n\nНомер телефона: " . $phone; $phone = $to; $cc = 0; // do not CC "sender" } // Add additional info to the message if ($this->extra["ip"]) { $message .= "\n\nIP: " . $_SERVER["REMOTE_ADDR"]; } if ($this->extra["user_agent"]) { $message .= "\n\nUSER AGENT: " . $_SERVER["HTTP_USER_AGENT"]; } // Set and wordwrap message body $body = "Имя: {$name}\n\n"; $body .= " Телефон: {$phone}\n\n"; $body .= " Сообщение: {$message}"; $body = wordwrap($body, 70); // Build header $headers = "From: {$phone}\n"; if ($cc == 1) { $headers .= "Cc: {$phone}\n"; } else { // you need to enable mb_encode_mimeheader or risk // getting phones that are not UTF-8 encoded } $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; charset=utf-8\n"; $headers .= "Content-Transfer-Encoding: quoted-printable\n"; // Send phone $configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_SMTP_ENCRYPTION', 'PS_MAIL_SMTP_PORT', 'PS_MAIL_METHOD', 'PS_MAIL_TYPE')); if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION'])) { $configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off'; } if (!isset($configuration['PS_MAIL_SMTP_PORT'])) { $configuration['PS_MAIL_SMTP_PORT'] = 25; } $fromName = $phone; if (!isset($from)) { $from = $configuration['PS_SHOP_EMAIL']; } if (!isset($fromName)) { $fromName = $configuration['PS_SHOP_NAME']; } $from = new Swift_Address($from, $fromName); $smtpChecked = $configuration['PS_MAIL_METHOD'] == 2; $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($configuration['PS_MAIL_SERVER']), Tools::htmlentitiesUTF8($body), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8('text/html'), Tools::htmlentitiesUTF8($this->to), $from, Tools::htmlentitiesUTF8($configuration['PS_MAIL_USER']), Tools::htmlentitiesUTF8($configuration['PS_MAIL_PASSWD']), Tools::htmlentitiesUTF8($configuration['PS_MAIL_SMTP_PORT']), Tools::htmlentitiesUTF8($configuration['PS_MAIL_SMTP_ENCRYPTION'])); if (!$result) { echo $this->display(__FILE__, 'callback_die.tpl'); } //die($result ? '' : echo $this->display(__FILE__, 'callback_die.tpl')); }