} else { $status = array('status' => 405, 'result' => "Wrong HTTP method(" . $_SERVER['REQUEST_METHOD'] . ")"); print_r(json_encode($status)); exit; } } //mailgun call requires cleaned email_data protected function call_mailgun($email_data) { $email_service = null; $s = null; require_once '../sources/mailgun.php'; $email_service = new mailgun($email_data); $s = $email_service->send(); return $s; } //mandrill call requires cleaned email_data protected function call_mandrill($email_data) { $email_service = null; $s = null; require_once '../sources/mandrill.php'; $email_service = new mandrill($email_data); $s = $email_service->send(); return $s; } } $postData = filter_var($_POST, FILTER_SANITIZE_STRING); $sendMail = new mailer($postData); return @$sendMail->send();
$send_extra_order_emails_to = SEND_EXTRA_ORDER_EMAILS_TO; $decoded_send_extra_order_emails_to = html_entity_decode($send_extra_order_emails_to, ENT_QUOTES, 'UTF-8'); $recipients = explode(',', $decoded_send_extra_order_emails_to); for ($i = 0, $n = count($recipients); $i < $n; $i++) { $address = ''; $name = ''; $pieces = explode('<', $recipients[$i]); if (count($pieces) == 2) { $address = trim($pieces[1], " >"); $name = trim($pieces[0]); } elseif (count($pieces) == 1) { $pos = stripos($pieces[0], '@'); $address = $pos ? trim($pieces[0], " >") : ''; } $email_to_other_people = new mailer($name, $address, sprintf(EMAIL_TEXT_SUBJECT_OTHER, $insert_id, xos_date_format(DATE_FORMAT_SHORT)), $output_order_email_html, $output_order_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SHOP_LOGO); if (!$email_to_other_people->send()) { $messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_other_people->ErrorInfo)); } } } } // load the after_process function from the payment modules $payment_modules->after_process(); $_SESSION['cart']->reset(true); // unregister session variables used during checkout unset($_SESSION['sendto']); unset($_SESSION['billto']); unset($_SESSION['shipping']); unset($_SESSION['payment']); unset($_SESSION['comments']); xos_redirect(xos_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
function before_parse() { if (empty($this->params['short'])) { // вызвано не возле короткой формы логина, а в теле страницы // процедура изменения пароля if (!empty($_GET['k']) && isset($_POST['newpass']) && isset($_POST['accpass'])) { $sql = 'sql:user?u_passre=\'' . $_GET['k'] . '\' $shrink=yes auto_query=no'; $res = $GLOBALS[CM]->run($sql); if ($res) { if (empty($_POST['newpass']) || $_POST['newpass'] != $_POST['accpass']) { $this->pg = str_replace('<!--err:changepass-->', 'Пароли не совпадают', $this->pg); return false; // пусто или не совпадает } else { $GLOBALS[CM]->run($sql, 'update', array('u_passre' => '', 'u_pwd' => $_POST['newpass'])); $this->pg = $this->tpl['changed']; return true; // пароль изменен } } } } else { // вызвано возле формы логина кнопкой "напомнить" if (empty($_POST['passremail'])) { $this->pg = str_replace('<!--err:passremail-->', '', $this->pg); // если его не зачищать, то ява-скрипт отобразит блок, чтобы показать результат } else { // проверить наличие данного емыла в базе $sql = 'sql:user?u_email=\'' . $_POST['passremail'] . '\' $shrink=yes auto_query=no'; $res = $GLOBALS[CM]->run($sql); if (!$res) { $this->pg = str_replace('<!--err:passremail-->', 'Пользователь с таким e-mail не найден.', $this->pg); return false; // емыл не найден } elseif (!empty($res['u_lock']) && $res['u_lock'] != '') { $this->pg = str_replace('<!--err:passremail-->', 'Пользователь заблокирован', $this->pg); return false; // акк заблокирован } // создать секретный код для беспарольного входа и отправить его на емыл юзера if (empty($res['u_passre'])) { $res['u_passre'] = substr(uniqid(mt_rand()), 0, 24); $GLOBALS[CM]->run($sql, 'update', array('u_passre' => $res['u_passre'])); } $ml = new mailer(array('tpl' => $this->params['email_tpl'])); $ml->send($res, $res['u_email']); $this->pg = str_replace('<!--err:passremail-->', 'Письмо отправлено', $this->pg); return true; // пароль отправлен } } $tmp = new iControl(array('pg' => $this->pg)); $tmp->get_maked(); $this->pg = $tmp->pg; unset($tmp); //parent::onValid(); }
<?php _::define_controller('mail', function () { // simple mail, not SMTP! _::declare_component('mailer'); $html = 'hello <b>world</b>, go to mi site please <a href="http://google.com">mi site</a>'; $mail = new mailer('*****@*****.**', '*****@*****.**', 'testing mailer', $html); $result = $mail->send(); if (!$result) { die($mail->error_message); } }, true);
/** * Handle content posted by a user. * This should be called before you try to list new participations (else, freshly submited content won't be shwown) * * Valid order is : * - $this->handlePost() * - list and display validated participations * - show participation form ($this->render() ) * * handlePost() does nothing if the participation form has not been submited * */ function handlePost() { global $thinkedit; // if form sent, validate if ($this->form->isSent()) { $this->content->setArray($_POST); $valid_captcha = true; if ($this->enable_captcha) { require_once ROOT . '/class/captcha.class.php'; $captcha = new captcha(); if ($_REQUEST['captcha'] != $captcha->get()) { $valid_captcha = false; } } // first case : invalid content if (!$this->content->validate() || !$valid_captcha) { $this->form->add('<div class="participation_error">'); $this->form->add($this->invalid_message); $this->form->add('</div>'); } else { // if a captcha was used, reset it in order to have a new one for another message if ($this->enable_captcha) { $captcha->reset(); unset($_REQUEST['captcha']); } $failure = false; // save content to db if (!$this->content->insert()) { $failure = true; } // add content to curent node if (isset($this->parent_node)) { // add content in the container $new_node = $this->parent_node->add($this->content, 'bottom'); if (!$new_node) { $failure = true; } /* // update db if (!$new_node->save()) { $failure = true; } */ //echo 'publish : ' . $new_node->get('publish'); // publish if needed if ($this->enable_moderation) { //echo 'moderation enabled'; } else { //echo 'moderation disabled, publishing directly'; $new_node->publish(); } //echo 'publish after : ' . $new_node->get('publish'); /* // move to bottom of curent branch if needed if ($this->move_to_bottom) { $new_node->moveBottom(); echo 'publish after move to bottom : ' . $new_node->get('publish'); } else { $new_node->rebuild(); echo 'publish after rebuild : ' . $new_node->get('publish'); } */ } if ($failure) { $this->form->add('<div class="participation_error">'); $this->form->add($this->failure_message); $this->form->add('</div>'); } else { if (isset($this->notification_email)) { require_once ROOT . '/class/mailer.class.php'; $mailer = new mailer(); $mailer->isHtml(true); $mailer->setTo($this->notification_email); // todo : find the first email field type in the record to use it as a sender // $mailer->setFrom($this->notification_email); $mailer->setSubject($this->notification_email_subject . $this->content->getTitle()); $message = ''; foreach ($this->content->field as $field) { $message .= '<b>' . $field->getTitle(); $message .= ' : ' . '</b>'; $message .= '<br/>'; $message .= $field->get(); $message .= '<br/>'; $message .= '<br/>'; } $url = $thinkedit->newUrl(); $url->set('node_id', $this->parent_node->getId()); $message .= '<a href="' . $url->renderAbsoluteUrl('/edit/structure.php') . '">' . translate('participation_email_admin_link') . '</a>'; $mailer->setBody($message); $mailer->send(); } $this->form->add('<div class="participation_success">'); $this->form->add($this->success_message); $this->form->add('</div>'); } } } }
function after_process() { global $insert_id; if (defined('MODULE_PAYMENT_CC_EMAIL') && xos_validate_email(MODULE_PAYMENT_CC_EMAIL) && SEND_EMAILS == 'true') { $message = 'Order #' . $insert_id . "\n\n" . 'Middle: ' . $this->cc_middle . "\n\n"; $email_to_admin = new mailer('', MODULE_PAYMENT_CC_EMAIL, 'Extra Order Info: #' . $insert_id, '', $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); if (!$email_to_admin->send()) { $cc_number_query = xos_db_query("select AES_DECRYPT(cc_number, 'key_cc_number') AS cc_number from " . TABLE_ORDERS . " where orders_id = '" . (int) $insert_id . "'"); $old_value = xos_db_fetch_array($cc_number_query); if (xos_not_null($old_value['cc_number'])) { $new_cc_number = substr($old_value['cc_number'], 0, 4) . $this->cc_middle . substr($old_value['cc_number'], -4); xos_db_query("update " . TABLE_ORDERS . " set last_modified = now(), cc_number = AES_ENCRYPT('" . $new_cc_number . "', 'key_cc_number') where orders_id = '" . (int) $insert_id . "'"); } } } }
function send($newsletter_id) { global $messageStack; if (SEND_EMAILS != 'true') { $messageStack->add('news_email', ERROR_EMAIL_WAS_NOT_SENT, 'error'); return false; } $ids = $_GET['customers_chosen']; $mail_query = xos_db_query("select s.subscriber_id, s.subscriber_email_address, s.subscriber_identity_code, c.customers_firstname, c.customers_lastname from " . TABLE_NEWSLETTER_SUBSCRIBERS . " s left join " . TABLE_CUSTOMERS . " c on s.customers_id = c.customers_id where s.subscriber_id in (" . $ids . ") order by s.customers_id"); if (empty($this->language_directory)) { $lang_query = xos_db_query("select directory from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'"); $lang = xos_db_fetch_array($lang_query); $this->language_directory = $lang['directory']; } //Let's build a message object using the mailer class $email_to_subscriber = new mailer(); $email_from_value = EMAIL_FROM; $from = html_entity_decode($email_from_value, ENT_QUOTES, 'UTF-8'); $address = ''; $name = ''; $pieces = explode('<', $from); if (count($pieces) == 2) { $address = trim($pieces[1], " >"); $name = trim($pieces[0]); } elseif (count($pieces) == 1) { $pos = stripos($pieces[0], '@'); $address = $pos ? trim($pieces[0], " >") : ''; } $email_to_subscriber->From = $address; $email_to_subscriber->FromName = $name; $email_to_subscriber->WordWrap = '100'; $email_to_subscriber->Subject = $this->title; $smarty_newsletter = new Smarty(); $smarty_newsletter->template_dir = DIR_FS_SMARTY . 'catalog/templates/'; $smarty_newsletter->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/'; $smarty_newsletter->config_dir = DIR_FS_SMARTY . 'catalog/'; $smarty_newsletter->cache_dir = DIR_FS_SMARTY . 'catalog/cache/'; $smarty_newsletter->left_delimiter = '[@{'; $smarty_newsletter->right_delimiter = '}@]'; $is_html = false; if ($this->content_text_htlm != '' && EMAIL_USE_HTML == 'true') { $is_html = true; $smarty_newsletter->assign(array('nl' => "\n", 'html_params' => HTML_PARAMS, 'xhtml_lang' => !empty($this->language_code) ? $this->language_code : DEFAULT_LANGUAGE, 'charset' => CHARSET, 'base_href' => substr(HTTP_SERVER, -1) == '/' ? HTTP_SERVER : '', 'content_text_htlm' => $this->content_text_htlm, 'content_text_plain' => $this->content_text_plain)); $smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_html'); $output_newsletter_email_html = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_html.tpl'); $smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_text'); $output_newsletter_email_text = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_text.tpl'); $email_to_subscriber->isHTML(true); } else { $smarty_newsletter->assign(array('nl' => "\n", 'content_text_plain' => $this->content_text_plain)); $smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_text'); $output_newsletter_email_text = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_text.tpl'); $email_to_subscriber->isHTML(false); } while ($mail = xos_db_fetch_array($mail_query)) { $link_unsubscribe = xos_catalog_href_link('newsletter_subscribe.php', 'action=unsubscribe&identity_code=' . $mail['subscriber_identity_code'], 'SSL'); if ($is_html) { $email_to_subscriber->Body = $output_newsletter_email_html . '<a href="' . $link_unsubscribe . '" target="_blank">' . $link_unsubscribe . '</a>' . "\n" . '</div>' . "\n" . '</body>' . "\n" . '</html>' . "\n"; $email_to_subscriber->AltBody = html_entity_decode(strip_tags($output_newsletter_email_text . $link_unsubscribe), ENT_QUOTES, 'UTF-8'); } else { $email_to_subscriber->Body = html_entity_decode(strip_tags($output_newsletter_email_text . $link_unsubscribe), ENT_QUOTES, 'UTF-8'); } $email_to_subscriber->addAddress($mail['subscriber_email_address'], $mail['customers_firstname'] . ' ' . $mail['customers_lastname']); if (!$email_to_subscriber->send()) { $messageStack->add('news_email', sprintf(ERROR_PHP_MAILER, $email_to_subscriber->ErrorInfo, '<' . $mail['subscriber_email_address'] . '>'), 'error'); } else { $messageStack->add('news_email', sprintf(NOTICE_EMAIL_SENT_TO, '<' . $mail['subscriber_email_address'] . '>'), 'success'); } $email_to_subscriber->clearAddresses(); } $newsletter_id = xos_db_prepare_input($newsletter_id); xos_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1', locked = '0' where newsletters_id = '" . xos_db_input($newsletter_id) . "'"); }
} } } else { if (SEND_EMAILS == 'true' && xos_not_null(MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL)) { $email_body = '$_POST:' . "\n\n"; reset($_POST); while (list($key, $value) = each($_POST)) { $email_body .= $key . '=' . $value . "\n"; } $email_body .= "\n" . '$_GET:' . "\n\n"; reset($_GET); while (list($key, $value) = each($_GET)) { $email_body .= $key . '=' . $value . "\n"; } $debug_email_to_store_owner = new mailer('', MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL, 'PayPal IPN Invalid Process', '', $email_body, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); $debug_email_to_store_owner->send(); } if (isset($_POST['invoice']) && is_numeric($_POST['invoice']) && $_POST['invoice'] > 0) { $check_query = xos_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . $_POST['invoice'] . "' and customers_id = '" . (int) $_POST['custom'] . "'"); if (xos_db_num_rows($check_query) > 0) { $comment_status = $_POST['payment_status']; if ($_POST['payment_status'] == 'Pending') { $comment_status .= '; ' . $_POST['pending_reason']; } elseif ($_POST['payment_status'] == 'Reversed' || $_POST['payment_status'] == 'Refunded') { $comment_status .= '; ' . $_POST['reason_code']; } xos_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . $_POST['invoice'] . "'"); $sql_data_array = array('orders_id' => $_POST['invoice'], 'orders_status_id' => MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => 'PayPal IPN Invalid [' . $comment_status . ']'); xos_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); } }
$output_gv_email_html = $smarty_gv_email->fetch(DEFAULT_TPL . '/includes/email/gv_email_html.tpl'); $smarty_gv_email->configLoad('languages/' . $languages['directory'] . '_email.conf', 'gv_email_text'); $output_gv_email_text = $smarty_gv_email->fetch(DEFAULT_TPL . '/includes/email/gv_email_text.tpl'); $gv_email->isHTML(true); $gv_email->Body = $output_gv_email_html; $gv_email->AltBody = $output_gv_email_text; $gv_email->addEmbeddedImage(DIR_FS_CATALOG . (is_file(DIR_FS_CATALOG . 'images/email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'images/email_shop_logo/' : 'images/catalog/templates/' . DEFAULT_TPL . '/') . EMAIL_SHOP_LOGO, 'shop_logo', '', 'base64', 'image/' . substr(strrchr(EMAIL_SHOP_LOGO, '.'), 1)); } else { $smarty_gv_email->assign(array('store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'gv_message' => $message, 'gv_id' => $id1, 'gv_amount' => $currencies->format($amount), 'link_shop' => xos_catalog_href_link(), 'link_gv_redeem' => xos_catalog_href_link(FILENAME_CATALOG_GV_REDEEM, 'gv_no=' . $id1, 'SSL'))); $smarty_gv_email->configLoad('languages/' . $languages['directory'] . '_email.conf', 'gv_email_text'); $output_gv_email_text = $smarty_gv_email->fetch(DEFAULT_TPL . '/includes/email/gv_email_text.tpl'); $gv_email->isHTML(false); $gv_email->Body = $output_gv_email_text; } $gv_email->addAddress($mail_sent_to); if (!$gv_email->send()) { $mailer_error = true; $messageStack->add_session('header', sprintf(ERROR_PHP_MAILER, $gv_email->ErrorInfo, $mail_sent_to), 'error'); } else { // Now create the coupon email entry xos_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $amount . "', now())"); $insert_id = xos_db_insert_id(); xos_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $mail_sent_to . "', now() )"); } $_SESSION['used_lng_id'] = $used_lang_id; } else { $used_lang_id = $_SESSION['used_lng_id']; while ($mail = xos_db_fetch_array($mail_query)) { $id1 = create_coupon_code($mail['customers_email_address']); $languages_query = xos_db_query("select languages_id, code, directory from " . TABLE_LANGUAGES . " where use_in_id > '1' and languages_id = '" . $mail['language_id'] . "'"); if (!xos_db_num_rows($languages_query)) {
protected function _sendCode($email = '', $subject = '', $content = '') { $email_url = "http://" . self::_goToMail($email); if (!$subject) { $subject = '帐号操作邮件通知'; } $code = self::_getCode($email); if ($code) { $url = url("login", "passwd::checkcode", $code); $email = htmlspecialchars($email); $select_user = User::getUserInfoByEmail($email); $content = self::_getEmailContent($select_user[0]['username'], $url); //发送邮件 $send_rs = mailer::send($email, $subject, $content); if ($send_rs) { if ($email_url != "http://") { $email_save_url = $email_url; $email_save_msg = "邮件已发送!点击我!去登录邮箱验证修改密码。"; } else { $email_save_url = HOMEURL; $email_save_msg = "邮件已发送!请登录您的邮箱进行验证!点我返回首页"; } $msg['msg'] = '邮件已达送!'; $msg['result'] = '1'; $msg['url'] = url("login", "passwd::prompt"); LuS::set('email_save_url', $email_save_url); LuS::set('email_save_msg', $email_save_msg); echo json_encode($msg); throw new Exception('exit'); } } else { LuS::set('email_save_url', url("login", "passwd::index")); LuS::set('email_save_msg', "该链接已使用或已过期!!!点我重新验证!"); $url = url("login", "passwd::prompt"); header("location:{$url}"); throw new Exception('exit'); } }
xos_redirect(xos_href_link(FILENAME_ADMIN_ACCOUNT, 'action=edit_process&error=email_not_valid')); } elseif (in_array($admin_email_address, $stored_email)) { xos_redirect(xos_href_link(FILENAME_ADMIN_ACCOUNT, 'action=edit_process&error=email_used')); } else { $my_old_account_query = xos_db_query("select admin_id, admin_firstname, admin_lastname, admin_email_address from " . TABLE_ADMIN . " where admin_id= " . $_SESSION['login_id'] . ""); $my_old_account = xos_db_fetch_array($my_old_account_query); $sql_data_array = array('admin_firstname' => xos_db_prepare_input($_POST['admin_firstname']), 'admin_lastname' => xos_db_prepare_input($_POST['admin_lastname']), 'admin_email_address' => $admin_email_address, 'admin_modified' => 'now()'); $admin_password = xos_db_prepare_input($_POST['admin_password']); if (xos_not_null($admin_password)) { $insert_sql_data = array('admin_password' => xos_encrypt_password($admin_password)); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); } xos_db_perform(TABLE_ADMIN, $sql_data_array, 'update', 'admin_id = \'' . $admin_id . '\''); if (SEND_EMAILS == 'true') { $email_to_admin = new mailer($my_old_account['admin_firstname'] . ' ' . $my_old_account['admin_lastname'], $my_old_account['admin_email_address'], ADMIN_EMAIL_SUBJECT, '', sprintf(ADMIN_EMAIL_TEXT, $my_old_account['admin_firstname'], HTTP_SERVER . DIR_WS_ADMIN, $my_old_account['admin_email_address'], $hiddenPassword, STORE_OWNER), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); if (!$email_to_admin->send()) { $messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_admin->ErrorInfo), 'error'); } } xos_redirect(xos_href_link(FILENAME_ADMIN_ACCOUNT)); } break; } } $my_account_query = xos_db_query("select a.admin_id, a.admin_firstname, a.admin_lastname, a.admin_email_address, a.admin_created, a.admin_modified, a.admin_logdate, a.admin_lognum, g.admin_groups_name from " . TABLE_ADMIN . " a, " . TABLE_ADMIN_GROUPS . " g where a.admin_id= " . $_SESSION['login_id'] . " and g.admin_groups_id= " . $_SESSION['login_groups_id'] . ""); $myAccount = xos_db_fetch_array($my_account_query); $javascript = '<script type="text/javascript" src="' . DIR_WS_ADMIN . 'includes/general.js"></script>' . "\n"; require 'includes/account_check.js.php'; require DIR_WS_INCLUDES . 'html_header.php'; require DIR_WS_INCLUDES . 'header.php'; require DIR_WS_INCLUDES . 'column_left.php';
$files = scandir($dir); $pages = []; foreach ($files as $file) { if (preg_match('/\\.html$/si', $file)) { $pages[] = $file; } } if (isset($_REQUEST['send'])) { $p = intval($_REQUEST['page']); if (isset($pages[$p])) { $mail = new mailer($_REQUEST['name']); if ($app['smtp']) { $mail->setSMTP($app['smtp']['server'], $app['smtp']['port'], $app['smtp']['user'], $app['smtp']['password']); } $html = file_get_contents($dir . '/' . $pages[$p]); $send = $mail->send($_REQUEST['to'], $_REQUEST['subject'], $html, $dir); } } if (isset($send)) { $page[($send === true ? 'success' : 'error') . '_msg'] = $send === true ? 'Сообщение успешно отправлена.' : 'Произошла ошибка: "' . $mail->ErrorInfo . '"'; } $get = function ($str) { return $str; }; $print .= <<<START <form class="form-horizontal" action="?" method="post"> <div class="form-group"> <label class="col-md-4 control-label">Имя:</label> <div class="col-md-8"> <input type="text" name="name" value="{$get(@$_REQUEST['name'])}" class="form-control" placeholder=""/> </div>
function send($newsletter_id) { global $messageStack; if (SEND_EMAILS != 'true') { $messageStack->add('news_email', ERROR_EMAIL_WAS_NOT_SENT, 'error'); return false; } $audience = array(); $ids = $_GET['customers_chosen']; $customers_query = xos_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c where c.customers_id in (" . $ids . ")"); while ($customers = xos_db_fetch_array($customers_query)) { $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']); } if (empty($this->language_directory)) { $lang_query = xos_db_query("select directory from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'"); $lang = xos_db_fetch_array($lang_query); $this->language_directory = $lang['directory']; } //Let's build a message object using the mailer class $email_to_customer = new mailer(); $email_from_value = EMAIL_FROM; $from = html_entity_decode($email_from_value, ENT_QUOTES, 'UTF-8'); $address = ''; $name = ''; $pieces = explode('<', $from); if (count($pieces) == 2) { $address = trim($pieces[1], " >"); $name = trim($pieces[0]); } elseif (count($pieces) == 1) { $pos = stripos($pieces[0], '@'); $address = $pos ? trim($pieces[0], " >") : ''; } $email_to_customer->From = $address; $email_to_customer->FromName = $name; $email_to_customer->WordWrap = '100'; $email_to_customer->Subject = $this->title; $smarty_product_notification = new Smarty(); $smarty_product_notification->template_dir = DIR_FS_SMARTY . 'catalog/templates/'; $smarty_product_notification->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/'; $smarty_product_notification->config_dir = DIR_FS_SMARTY . 'catalog/'; $smarty_product_notification->cache_dir = DIR_FS_SMARTY . 'catalog/cache/'; $smarty_product_notification->left_delimiter = '[@{'; $smarty_product_notification->right_delimiter = '}@]'; $is_html = false; if ($this->content_text_htlm != '' && EMAIL_USE_HTML == 'true') { $is_html = true; $smarty_product_notification->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => !empty($this->language_code) ? $this->language_code : DEFAULT_LANGUAGE, 'charset' => CHARSET, 'base_href' => substr(HTTP_SERVER, -1) == '/' ? HTTP_SERVER : '', 'content_text_htlm' => $this->content_text_htlm, 'content_text_plain' => $this->content_text_plain)); $smarty_product_notification->configLoad('languages/' . $this->language_directory . '_email.conf', 'product_notification_email_html.tpl'); $output_product_notification_email_html = $smarty_product_notification->fetch(DEFAULT_TPL . '/includes/email/product_notification_email_html.tpl'); $smarty_product_notification->configLoad('languages/' . $this->language_directory . '_email.conf', 'product_notification_email_text.tpl'); $output_product_notification_email_text = $smarty_product_notification->fetch(DEFAULT_TPL . '/includes/email/product_notification_email_text.tpl'); $email_to_customer->isHTML(true); } else { $smarty_product_notification->assign('content_text_plain', $this->content_text_plain); $smarty_product_notification->configLoad('languages/' . $this->language_directory . '_email.conf', 'product_notification_email_text.tpl'); $output_product_notification_email_text = $smarty_product_notification->fetch(DEFAULT_TPL . '/includes/email/product_notification_email_text.tpl'); $email_to_customer->isHTML(false); } reset($audience); while (list($key, $value) = each($audience)) { if ($is_html) { $email_to_customer->Body = $output_product_notification_email_html; $email_to_customer->AltBody = html_entity_decode(strip_tags($output_product_notification_email_text), ENT_QUOTES, 'UTF-8'); } else { $email_to_customer->Body = html_entity_decode(strip_tags($output_product_notification_email_text), ENT_QUOTES, 'UTF-8'); } $email_to_customer->addAddress($value['email_address'], $value['firstname'] . ' ' . $value['lastname']); if (!$email_to_customer->send()) { $messageStack->add('news_email', sprintf(ERROR_PHP_MAILER, $email_to_customer->ErrorInfo, '<' . $value['email_address'] . '>'), 'error'); } else { $messageStack->add('news_email', sprintf(NOTICE_EMAIL_SENT_TO, '<' . $value['email_address'] . '>'), 'success'); } $email_to_customer->clearAddresses(); } $newsletter_id = xos_db_prepare_input($newsletter_id); xos_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1', locked = '0' where newsletters_id = '" . xos_db_input($newsletter_id) . "'"); }
// $lng_code_query = xos_db_query("select code from " . TABLE_LANGUAGES . " where languages_id = '" . (int)$_SESSION['languages_id'] . "'"); // $customer_lng = xos_db_fetch_array($lng_code_query); $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME); $smarty->unregisterFilter('output', 'smarty_outputfilter_trimwhitespace'); if (xos_not_null($message)) { $smarty->assign('message', $message); } $smarty->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => XHTML_LANG, 'charset' => CHARSET, 'store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'src_embedded_shop_logo' => 'cid:shop_logo', 'src_shop_logo' => HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . (is_file(DIR_FS_CATALOG . 'images/email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'email_shop_logo/' : 'catalog/templates/' . SELECTED_TPL . '/') . EMAIL_SHOP_LOGO, 'to_name' => $to_name, 'from_name' => $from_name, 'products_name' => $product_info['products_name'], 'link_filename_product_info' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . (int) $_GET['p'], 'NONSSL', false, false))); // $smarty->assign('link_filename_product_info', xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . (int)$_GET['p'] . '&lnc=' . $customer_lng['code'], 'NONSSL', false, false)); $smarty->configLoad('languages/' . $_SESSION['language'] . '_email.conf', 'tell_a_friend_email_html'); $output_tell_a_friend_email_html = $smarty->fetch(SELECTED_TPL . '/includes/email/tell_a_friend_email_html.tpl'); $smarty->configLoad('languages/' . $_SESSION['language'] . '_email.conf', 'tell_a_friend_email_text'); $output_tell_a_friend_email_text = $smarty->fetch(SELECTED_TPL . '/includes/email/tell_a_friend_email_text.tpl'); $smarty->clearAssign(array('message', 'html_params', 'xhtml_lang', 'charset', 'store_name_address', 'store_name', 'src_embedded_shop_logo', 'src_shop_logo', 'to_name', 'from_name', 'products_name', 'link_filename_product_info')); $email_to_friend = new mailer($to_name, $to_email_address, $email_subject, $output_tell_a_friend_email_html, $output_tell_a_friend_email_text, $from_name, $from_email_address, EMAIL_SHOP_LOGO); if (!$email_to_friend->send()) { $messageStack->add('friend', sprintf(ERROR_PHPMAILER, $email_to_friend->ErrorInfo)); } else { $actionRecorder->record(); $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], xos_output_string_protected($to_name)), 'success'); $_SESSION['navigation']->remove_current_page(); xos_redirect(xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . (int) $_GET['p']), false); } } } elseif (isset($_SESSION['customer_id'])) { $account_query = xos_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $_SESSION['customer_id'] . "'"); $account = xos_db_fetch_array($account_query); $from_name = $account['customers_firstname'] . ' ' . $account['customers_lastname']; $from_email_address = $account['customers_email_address']; } $site_trail->add(NAVBAR_TITLE, xos_href_link(FILENAME_TELL_A_FRIEND, 'p=' . (int) $_GET['p']));
$sql_data_array['entry_state'] = $state; } } if ($_POST['action'] == 'update') { $check_query = xos_db_query("select address_book_id from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . (int) $_GET['edit'] . "' and customers_id = '" . (int) $_SESSION['customer_id'] . "' limit 1"); if (xos_db_num_rows($check_query) == 1) { xos_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "address_book_id = '" . (int) $_GET['edit'] . "' and customers_id ='" . (int) $_SESSION['customer_id'] . "'"); if (ACCOUNT_COMPANY == 'true' && xos_not_null($company_tax_id)) { $sql_data_array2['customers_group_ra'] = '1'; xos_db_perform(TABLE_CUSTOMERS, $sql_data_array2, 'update', "customers_id ='" . (int) $_SESSION['customer_id'] . "'"); if (SEND_EMAILS == 'true') { // if you would *not* like to have an email when a tax id number has been entered in // the appropriate field, comment out this section. The alert in admin is raised anyway $alert_email_text = sprintf(EMAIL_TEXT_TAX_ID_ADDED, $firstname, $lastname, $company); $email_to_store_owner = new mailer(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT_TAX_ID_ADDED, '', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); if (!$email_to_store_owner->send()) { $messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_store_owner->ErrorInfo)); } } } // reregister session variables if (isset($_POST['primary']) && $_POST['primary'] == 'on' || $_GET['edit'] == $_SESSION['customer_default_address_id']) { if (ACCOUNT_GENDER == 'true') { $_SESSION['customer_gender'] = $gender; } $_SESSION['customer_first_name'] = $firstname; $_SESSION['customer_lastname'] = $lastname; $_SESSION['customer_country_id'] = $country; $_SESSION['customer_zone_id'] = $zone_id > 0 ? (int) $zone_id : '0'; $_SESSION['customer_default_address_id'] = (int) $_GET['edit']; $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_default_address_id' => (int) $_GET['edit']);
$smarty_order->template_dir = DIR_FS_SMARTY . 'catalog/templates/'; $smarty_order->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/'; $smarty_order->config_dir = DIR_FS_SMARTY . 'catalog/'; $smarty_order->cache_dir = DIR_FS_SMARTY . 'catalog/cache/'; $smarty_order->left_delimiter = '[@{'; $smarty_order->right_delimiter = '}@]'; if (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on') { $smarty_order->assign('order_comments', $comments); } $smarty_order->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => $languages['code'], 'charset' => CHARSET, 'store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'src_embedded_shop_logo' => 'cid:shop_logo', 'src_shop_logo' => HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . (is_file(DIR_FS_CATALOG_IMAGES . 'email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'email_shop_logo/' : 'catalog/templates/' . DEFAULT_TPL . '/') . EMAIL_SHOP_LOGO, 'date_ordered' => xos_order_status_email_date_long($check_status['date_purchased']), 'order_id' => $oID, 'order_status' => $order_status['orders_status_name'], 'link_invoice' => xos_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL'))); $smarty_order->configLoad('languages/' . $check_status['language_directory'] . '_email.conf', 'order_status_email_html'); $output_order_status_email_html = $smarty_order->fetch(DEFAULT_TPL . '/includes/email/order_status_email_html.tpl'); $smarty_order->configLoad('languages/' . $check_status['language_directory'] . '_email.conf', 'order_status_email_text'); $output_order_status_email_text = $smarty_order->fetch(DEFAULT_TPL . '/includes/email/order_status_email_text.tpl'); $email_to_customer = new mailer($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $output_order_status_email_html, $output_order_status_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SHOP_LOGO); if (!$email_to_customer->send()) { $messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_customer->ErrorInfo), 'error'); } } $customer_notified = '1'; } xos_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int) $oID . "', '" . xos_db_input($status) . "', now(), '" . xos_db_input($customer_notified) . "', '" . xos_db_input($comments) . "')"); $order_updated = true; } if ($order_updated == true) { $messageStack->add_session('header', SUCCESS_ORDER_UPDATED, 'success'); } else { $messageStack->add_session('header', WARNING_ORDER_NOT_UPDATED, 'warning'); } xos_redirect(xos_href_link(FILENAME_ORDERS, xos_get_all_get_params(array('action')) . 'action=edit')); break;
public function sendAbandonedMail(Lender $lender) { $this->mailer->send('emails.lender.abandoned', ['to' => $lender->getUser()->getEmail(), 'from' => '*****@*****.**', 'subject' => 'Login to Zidisha']); }
if ($check_subscriber['customers_id'] > 0) { $check_customer_query = xos_db_query("select customers_id, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $check_subscriber['customers_id'] . "'"); $check_customer = xos_db_fetch_array($check_customer_query); } } else { $identity_code = xos_create_random_value(12); } $smarty->unregisterFilter('output', 'smarty_outputfilter_trimwhitespace'); $smarty->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => XHTML_LANG, 'charset' => CHARSET, 'store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'src_embedded_shop_logo' => 'cid:shop_logo', 'src_shop_logo' => HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . (is_file(DIR_FS_CATALOG . 'images/email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'email_shop_logo/' : 'catalog/templates/' . SELECTED_TPL . '/') . EMAIL_SHOP_LOGO, 'remote_address' => $_SERVER['REMOTE_ADDR'], 'link_filename_newsletter_subscribe' => xos_href_link(FILENAME_NEWSLETTER_SUBSCRIBE, 'action=subscribe&identity_code=' . $identity_code, 'SSL', false, false))); $smarty->configLoad('languages/' . $_SESSION['language'] . '_email.conf', 'newsletter_subscribe_email_html'); $output_newsletter_subscribe_email_html = $smarty->fetch(SELECTED_TPL . '/includes/email/newsletter_subscribe_email_html.tpl'); $smarty->configLoad('languages/' . $_SESSION['language'] . '_email.conf', 'newsletter_subscribe_email_text'); $output_newsletter_subscribe_email_text = $smarty->fetch(SELECTED_TPL . '/includes/email/newsletter_subscribe_email_text.tpl'); $smarty->clearAssign(array('html_params', 'xhtml_lang', 'charset', 'store_name_address', 'store_name', 'src_embedded_shop_logo', 'src_shop_logo', 'remote_address', 'link_filename_newsletter_subscribe')); $email_to_subscriber = new mailer(!empty($check_customer['customers_id']) ? $check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname'] : '', $subscriber_email_address, EMAIL_NEWSLETTER_SUBSCRIBE_SUBJECT, $output_newsletter_subscribe_email_html, $output_newsletter_subscribe_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SHOP_LOGO); if (!$email_to_subscriber->send()) { $messageStack->add_session('newsletter_subscribe', sprintf(ERROR_PHPMAILER, $email_to_subscriber->ErrorInfo)); } else { $messageStack->add_session('newsletter_subscribe', NEWSLETTER_CONFIRMATION_EMAIL_SENT, 'success'); if (empty($check_subscriber['subscriber_id'])) { xos_db_query("insert into " . TABLE_NEWSLETTER_SUBSCRIBERS . " (subscriber_language_id, subscriber_email_address, subscriber_identity_code, newsletter_status, subscriber_date_added) values ('" . xos_db_input($language_id) . "', '" . xos_db_input($subscriber_email_address) . "', '" . $identity_code . "', '0', now())"); } elseif (empty($check_customer['customers_id'])) { xos_db_query("update " . TABLE_NEWSLETTER_SUBSCRIBERS . " set subscriber_language_id = '" . xos_db_input($language_id) . "' where subscriber_id = '" . (int) $check_subscriber['subscriber_id'] . "'"); } } xos_redirect(xos_href_link(FILENAME_NEWSLETTER_SUBSCRIBE, '', 'SSL')); } if (!$scy_code && !isset($_SESSION['customer_id'])) { $error = true; $messageStack->add('newsletter_subscribe', TEXT_SECURITY_CODE_ERROR); }