Example #1
0
 public function addReview($product_id, $data)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int) $this->customer->getId() . "', product_id = '" . (int) $product_id . "', text = '" . $this->db->escape($data['text']) . "', rating = '" . (int) $data['rating'] . "', date_added = NOW()");
     // Send to main admin email if new account email is enabled
     if ($this->config->get('config_review_mail')) {
         $this->load->language('mail/review');
         $this->load->model('catalog/product');
         $product_info = $this->model_catalog_product->getProduct($product_id);
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = $this->language->get('text_waiting') . "\n";
         $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($product_info['name']))) . "\n";
         $message .= sprintf($this->language->get('text_reviewer'), $this->db->escape(strip_tags($data['name']))) . "\n";
         $message .= sprintf($this->language->get('text_rating'), $this->db->escape(strip_tags($data['rating']))) . "\n";
         $message .= $this->language->get('text_review') . "\n";
         $message .= $this->db->escape(strip_tags($data['text'])) . "\n\n";
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo(array($this->config->get('config_email')));
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         // Send to additional alert emails
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if ($email && preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
 }
Example #2
0
 public function addReview($product_id, $data)
 {
     $this->trigger->fire('pre.review.add', array(&$data));
     $this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int) $this->customer->getId() . "', product_id = '" . (int) $product_id . "', text = '" . $this->db->escape($data['text']) . "', rating = '" . (int) $data['rating'] . "', date_added = NOW()");
     $review_id = $this->db->getLastId();
     if ($this->config->get('config_review_mail')) {
         $this->load->language('mail/review');
         $this->load->model('catalog/product');
         $product_info = $this->model_catalog_product->getProduct($product_id);
         $data['product'] = $product_info['name'];
         $subject = $this->emailtemplate->getSubject('Review', 'reviews_1', $data);
         $message = $this->emailtemplate->getMessage('Review', 'reviews_1', $data);
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo(html_entity_decode($this->config->get('config_email'), ENT_QUOTES, 'UTF-8'));
         $mail->setFrom(html_entity_decode($this->config->get('config_email'), ENT_QUOTES, 'UTF-8'));
         $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
         $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
         $mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         // Send to additional alert emails
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
     $this->trigger->fire('post.review.add', array(&$review_id));
 }
Example #3
0
 public function addAskquestion($product_id, $data)
 {
     $this->load->model('catalog/product');
     $product_info = $this->model_catalog_product->getProduct($product_id);
     $subject = sprintf($this->language->get('text_subject_e_ask'), html_entity_decode($data['name1'], ENT_QUOTES, 'UTF-8'), html_entity_decode($product_info['name'], ENT_QUOTES, 'UTF-8'));
     $message = sprintf($this->language->get('text_product_e_ask'), html_entity_decode($product_info['name'], ENT_QUOTES, 'UTF-8')) . "\n";
     $message .= sprintf($this->language->get('text_url_e_ask'), html_entity_decode($this->url->link('product/product', '&product_id=' . $this->db->escape(html_entity_decode($product_info['product_id']))))) . "\n\n";
     $message .= sprintf($this->language->get('text_name_e_ask'), html_entity_decode($data['name1'], ENT_QUOTES, 'UTF-8')) . "\n";
     $message .= sprintf($this->language->get('text_email_e_ask'), html_entity_decode($data['email1'], ENT_QUOTES, 'UTF-8')) . "\n\n\n";
     $message .= $this->language->get('text_question_e_ask') . "\n\n";
     $message .= html_entity_decode($data['text1'], ENT_QUOTES, 'UTF-8') . "\n\n";
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
     $mail->smtp_username = $this->config->get('config_mail_smtp_username');
     $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
     $mail->smtp_port = $this->config->get('config_mail_smtp_port');
     $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
     $mail->setTo($this->config->get('config_email'));
     $mail->setFrom(html_entity_decode($data['email1']));
     $mail->setSender(html_entity_decode($data['name1'], ENT_QUOTES, 'UTF-8'));
     $mail->setSubject($subject);
     $mail->setText($message);
     $mail->send();
     $emails = explode(',', $this->config->get('config_mail_alert'));
     foreach ($emails as $email) {
         if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
             $mail->setTo($email);
             $mail->send();
         }
     }
 }
Example #4
0
 public function addCustomer($data)
 {
     if (isset($data['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($data['customer_group_id'], $this->config->get('config_customer_group_display'))) {
         $customer_group_id = $data['customer_group_id'];
     } else {
         $customer_group_id = $this->config->get('config_customer_group_id');
     }
     $this->load->model('account/customer_group');
     $customer_group_info = $this->model_account_customer_group->getCustomerGroup($customer_group_id);
     $this->db->query("INSERT INTO " . DB_PREFIX . "customer SET store_id = '" . (int) $this->config->get('config_store_id') . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '******'password'])))) . "', newsletter = '" . (isset($data['newsletter']) ? (int) $data['newsletter'] : 0) . "', customer_group_id = '" . (int) $customer_group_id . "', ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', status = '1', approved = '" . (int) (!$customer_group_info['approval']) . "', date_added = NOW()");
     $customer_id = $this->db->getLastId();
     $this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int) $customer_id . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "'");
     $address_id = $this->db->getLastId();
     $this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int) $address_id . "' WHERE customer_id = '" . (int) $customer_id . "'");
     $this->load->language('mail/customer');
     $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
     $message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
     if (!$customer_group_info['approval']) {
         $message .= $this->language->get('text_login') . "\n";
     } else {
         $message .= $this->language->get('text_approval') . "\n";
     }
     $message .= $this->url->link('account/login', '', 'SSL') . "\n\n";
     $message .= $this->language->get('text_services') . "\n\n";
     $message .= $this->language->get('text_thanks') . "\n";
     $message .= $this->config->get('config_name');
     $mail = new Mail($this->config->get('config_mail'));
     $mail->setTo($data['email']);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $mail->setSubject($subject);
     $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
     // Send to main admin email if new account email is enabled
     if ($this->config->get('config_account_mail')) {
         $message = $this->language->get('text_signup') . "\n\n";
         $message .= $this->language->get('text_website') . ' ' . $this->config->get('config_name') . "\n";
         $message .= $this->language->get('text_firstname') . ' ' . $data['firstname'] . "\n";
         $message .= $this->language->get('text_lastname') . ' ' . $data['lastname'] . "\n";
         $message .= $this->language->get('text_customer_group') . ' ' . $customer_group_info['name'] . "\n";
         if ($data['company']) {
             $message .= $this->language->get('text_company') . ' ' . $data['company'] . "\n";
         }
         $message .= $this->language->get('text_email') . ' ' . $data['email'] . "\n";
         $message .= $this->language->get('text_telephone') . ' ' . $data['telephone'] . "\n";
         $mail->setTo($this->config->get('config_email'));
         $mail->setSubject(html_entity_decode($this->language->get('text_new_customer'), ENT_QUOTES, 'UTF-8'));
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         // Send to additional alert emails if new account email is enabled
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if (utf8_strlen($email) > 0 && preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
     return $customer_id;
 }
Example #5
0
 public function addComment($blog_id, $data)
 {
     $this->event->trigger('pre.comment.add', $data);
     $this->db->query("INSERT INTO " . DB_PREFIX . "comment SET commenter = '" . $this->db->escape($data['commenter']) . "', customer_id = '" . (int) $this->customer->getId() . "', blog_id = '" . (int) $blog_id . "', text = '" . $this->db->escape($data['text']) . "', date_added = NOW()");
     $comment_id = $this->db->getLastId();
     if ($this->config->get('config_blog_comment_mail')) {
         $this->load->language('mail/comment');
         $this->load->model('blog/blog');
         $blog_info = $this->model_blog_blog->getblog($blog_id);
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = $this->language->get('text_waiting') . "\n";
         $message .= sprintf($this->language->get('text_blog'), $this->db->escape(strip_tags($blog_info['name']))) . "\n";
         $message .= sprintf($this->language->get('text_commenter'), $this->db->escape(strip_tags($data['commenter']))) . "\n";
         $message .= $this->language->get('text_comment') . "\n";
         $message .= $this->db->escape(strip_tags($data['text'])) . "\n\n";
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo(array($this->config->get('config_email')));
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         // Send to additional alert emails
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
     $this->event->trigger('post.comment.add', $comment_id);
 }
Example #6
0
 public function addReturn($data)
 {
     $this->trigger->fire('pre.return.add', array(&$data));
     $this->db->query("INSERT INTO `" . DB_PREFIX . "return` SET order_id = '" . (int) $data['order_id'] . "', customer_id = '" . (int) $this->customer->getId() . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', product = '" . $this->db->escape($data['product']) . "', model = '" . $this->db->escape($data['model']) . "', quantity = '" . (int) $data['quantity'] . "', opened = '" . (int) $data['opened'] . "', return_reason_id = '" . (int) $data['return_reason_id'] . "', return_status_id = '" . (int) $this->config->get('config_return_status_id') . "', comment = '" . $this->db->escape($data['comment']) . "', date_ordered = '" . $this->db->escape($data['date_ordered']) . "', date_added = NOW(), date_modified = NOW()");
     $return_id = $this->db->getLastId();
     if ($this->config->get('config_return_mail')) {
         $this->load->model('localisation/return_reason');
         $return_reason = $this->model_localisation_return_reason->getReturnReason((int) $data['return_reason_id']);
         $return_data = array('order_id' => (int) $data['order_id'], 'date_ordered' => $data['date_ordered'], 'firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'email' => $data['email'], 'telephone' => $data['telephone'], 'product' => $data['product'], 'model' => $data['model'], 'quantity' => (int) $data['quantity'], 'return_reason' => $return_reason['name'], 'opened' => $data['opened'], 'comment' => $data['comment']);
         $subject = $this->emailtemplate->getSubject('Return', 'return_1', $return_data);
         $message = $this->emailtemplate->getMessage('Return', 'return_1', $return_data);
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setTo($this->config->get('config_email'));
         $mail->setSubject($subject);
         $mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         if ($this->config->get('config_alert_emails')) {
             $emails = explode(',', $this->config->get('config_alert_emails'));
             foreach ($emails as $email) {
                 if ($email && preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $email)) {
                     $mail->setTo($email);
                     $mail->send();
                 }
             }
         }
     }
     $this->trigger->fire('post.return.add', array(&$return_id));
     return $return_id;
 }
Example #7
0
 function emailAdmin($title, $admin_subject, array $vars)
 {
     $this->mail->send('emails.contact_us', ['title' => $title, 'vars' => $vars], function ($message) use($admin_subject) {
         $message->subject($admin_subject);
         foreach (Config::get('c21.admin-emails') as $admin_email) {
             $message->bcc($admin_email);
         }
         $message->to(Config::get('c21.recruiter.email'));
     });
 }
 public function index()
 {
     if ($this->config->get('config_remember_billet')) {
         $this->load->model('cron/remember_billet');
         $orders = $this->model_cron_remember_billet->getOrdersWaitingPaymentBillet();
         if ($orders) {
             foreach ($orders as $order) {
                 $subject = 'Seus produtos estão ansiosos para ir para casa!';
                 $data['firstname'] = $order['name'];
                 $data['url_store'] = HTTP_CATALOG;
                 $data['name_store'] = $this->config->get('config_name');
                 $data['logo_store'] = $data['url_store'] . 'image/' . $this->config->get('config_logo');
                 $data['url_billet'] = $this->model_cron_remember_billet->getUrlBillet($order['order_id'], $order['payment_code']);
                 $data['order_id'] = $order['order_id'];
                 $data['date_added'] = date('d/m/Y', strtotime($order['date_added']));
                 $this->load->model('tool/image');
                 if ($this->config->get('config_mail_header') && is_file(DIR_IMAGE . $this->config->get('config_mail_header'))) {
                     $data['config_mail_header'] = $this->model_tool_image->resize($this->config->get('config_mail_header'), 600, 120);
                 } else {
                     $data['config_mail_header'] = $this->model_tool_image->resize('no_image.png', 600, 120);
                 }
                 if ($this->config->get('config_mail_footer') && is_file(DIR_IMAGE . $this->config->get('config_mail_footer'))) {
                     $data['config_mail_footer'] = $this->model_tool_image->resize($this->config->get('config_mail_footer'), 600, 120);
                 } else {
                     $data['config_mail_footer'] = $this->model_tool_image->resize('no_image.png', 600, 120);
                 }
                 if (file_exists(DIR_TEMPLATE . 'mail/remember_billet.tpl')) {
                     $html = $this->load->view('mail/remember_billet.tpl', $data);
                 } else {
                     $html = $this->load->view('mail/remember_billet.tpl', $data);
                 }
                 if (!empty($data['url_billet']) && !empty($order['email'])) {
                     $mail = new Mail($this->config->get('config_mail'));
                     $mail->setTo($order['email']);
                     $mail->setFrom($this->config->get('config_email'));
                     $mail->setSender($this->config->get('config_name'));
                     $mail->setSubject($subject);
                     $mail->setHtml($html);
                     $mail->setText(html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8'));
                     $mail->send();
                     echo 'E-mail enviado';
                 }
                 $emails = explode(',', $this->config->get('config_mail_alert'));
                 if ($emails) {
                     foreach ($emails as $email) {
                         if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
                             $mail->setTo($email);
                             $mail->send();
                         }
                     }
                 }
             }
         }
     }
 }
Example #9
0
 /**
  * Send the notification.
  *
  * @return EmailResponse $return Response object
  */
 public function push()
 {
     $this->mail->set_from($this->source);
     $this->mail->add_to($this->endpoint);
     $payload_array = json_decode($this->payload, TRUE);
     $this->mail->set_subject($payload_array['subject']);
     $this->mail->set_message($payload_array['body']);
     $response = $this->mail->send();
     $res = new EmailResponse($response, $this->logger, $this->endpoint);
     $this->endpoint = '';
     $this->payload = '';
     return $res;
 }
Example #10
0
 public function addCustomer($data)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "customer SET store_id = '" . (int) $this->config->get('config_store_id') . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', password = '******'password'])) . "', newsletter = '" . (isset($data['newsletter']) ? (int) $data['newsletter'] : 0) . "', customer_group_id = '" . (int) $this->config->get('config_customer_group_id') . "', status = '1', date_added = NOW()");
     $customer_id = $this->db->getLastId();
     $this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int) $customer_id . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "'");
     $address_id = $this->db->getLastId();
     $this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int) $address_id . "' WHERE customer_id = '" . (int) $customer_id . "'");
     if (!$this->config->get('config_customer_approval')) {
         $this->db->query("UPDATE " . DB_PREFIX . "customer SET approved = '1' WHERE customer_id = '" . (int) $customer_id . "'");
     }
     $this->language->load('mail/customer');
     $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
     $message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
     if (!$this->config->get('config_customer_approval')) {
         $message .= $this->language->get('text_login') . "\n";
     } else {
         $message .= $this->language->get('text_approval') . "\n";
     }
     $message .= $this->url->link('account/login', '', 'SSL') . "\n\n";
     $message .= $this->language->get('text_services') . "\n\n";
     $message .= $this->language->get('text_thanks') . "\n";
     $message .= $this->config->get('config_name');
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->hostname = $this->config->get('config_smtp_host');
     $mail->username = $this->config->get('config_smtp_username');
     $mail->password = $this->config->get('config_smtp_password');
     $mail->port = $this->config->get('config_smtp_port');
     $mail->timeout = $this->config->get('config_smtp_timeout');
     $mail->setTo($this->request->post['email']);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $mail->setSubject($subject);
     $mail->setText($message);
     $mail->send();
     // Send to main admin email if new account email is enabled
     if ($this->config->get('config_account_mail')) {
         $mail->setTo($this->config->get('config_email'));
         $mail->send();
         // Send to additional alert emails if new account email is enabled
         $emails = explode(',', $this->config->get('config_alert_emails'));
         foreach ($emails as $email) {
             if (strlen($email) > 0 && preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
 }
 public function send($data, $type, $language_id = false)
 {
     if (!$language_id) {
         $language_id = $this->config->get('config_language_id');
     }
     $template_info = $this->getEmailTemplateByType($type);
     if ($template_info) {
         $variables = explode(',', $template_info['variables']);
         $search = array();
         $replace = array();
         foreach ($variables as $variable) {
             $variable = trim($variable);
             if ($variable && isset($data[$variable])) {
                 $search[] = '{' . $variable . '}';
                 $replace[] = $data[$variable];
             }
         }
         $subject = str_replace($search, $replace, html_entity_decode($template_info['description'][$language_id]['subject'], ENT_QUOTES));
         $message = str_replace($search, $replace, html_entity_decode($template_info['description'][$language_id]['html'], ENT_QUOTES));
         $template_data = array();
         $template_data['name'] = $this->config->get('config_name');
         $template_data['subject'] = $subject;
         $template_data['message'] = $message;
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_theme') . '/template/mail/general.tpl')) {
             $html = $this->load->view($this->config->get('config_theme') . '/template/mail/general.tpl', $template_data);
         } else {
             $html = $this->load->view('default/template/mail/general.tpl', $template_data);
         }
         $text = str_replace($search, $replace, html_entity_decode($template_info['description'][$language_id]['text'], ENT_QUOTES));
         if ($subject && isset($data['to_email'])) {
             $mail = new Mail($this->config->get('config_mail'));
             $mail->setTo($data['to_email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender($this->config->get('config_name'));
             $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
             $mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
             $mail->setHtml($html);
             $mail->send();
             if ($template_info['email']) {
                 $emails = explode(',', $template_info['email']);
                 foreach ($emails as $email) {
                     $mail->setTo(trim($email));
                     $mail->send();
                 }
             }
         }
     }
 }
Example #12
0
 public function sendReminderMail($email, $token)
 {
     $data = ['token' => $token];
     \Mail::send('emails.passwordReminder', $data, function ($message) use($email) {
         $message->to($email)->subject('パスワード再設定 - Owl');
     });
 }
Example #13
0
 public function addAffiliate($data)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "affiliate SET firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '******'password'])))) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "', code = '" . $this->db->escape(uniqid()) . "', commission = '" . (double) $this->config->get('config_commission') . "', tax = '" . $this->db->escape($data['tax']) . "', payment = '" . $this->db->escape($data['payment']) . "', cheque = '" . $this->db->escape($data['cheque']) . "', paypal = '" . $this->db->escape($data['paypal']) . "', bank_name = '" . $this->db->escape($data['bank_name']) . "', bank_branch_number = '" . $this->db->escape($data['bank_branch_number']) . "', bank_swift_code = '" . $this->db->escape($data['bank_swift_code']) . "', bank_account_name = '" . $this->db->escape($data['bank_account_name']) . "', bank_account_number = '" . $this->db->escape($data['bank_account_number']) . "', status = '1', date_added = NOW()");
     $this->language->load('mail/affiliate');
     $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
     $message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
     $message .= $this->language->get('text_approval') . "\n";
     $message .= $this->url->link('affiliate/login', '', 'SSL') . "\n\n";
     $message .= $this->language->get('text_services') . "\n\n";
     $message .= $this->language->get('text_thanks') . "\n";
     $message .= $this->config->get('config_name');
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->hostname = $this->config->get('config_smtp_host');
     $mail->username = $this->config->get('config_smtp_username');
     $mail->password = $this->config->get('config_smtp_password');
     $mail->port = $this->config->get('config_smtp_port');
     $mail->timeout = $this->config->get('config_smtp_timeout');
     $mail->setTo($this->request->post['email']);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
     $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
 }
Example #14
0
 public function create()
 {
     $uid = Auth::user()->id;
     $message = new Message();
     $message->title = Input::get('title');
     $message->body = Input::get('body');
     $message->mass_message = 0;
     $message->author_id = $uid;
     if (Input::get('recipient') != null) {
         $recipient = DB::table('users')->where('email', '=', Input::get('recipient'))->first();
         $message->recipient_id = $recipient->id;
     } else {
         $message->recipient_id = null;
     }
     $message->save();
     if (Input::get('recipient') != null) {
         $email = Input::get('recipient');
         $username = $recipient->email;
         $body = Input::get('body');
         $data = ['username' => $username, 'body' => $body];
         Mail::send('emails.adminmessage', $data, function ($message) {
             $message->to(Input::get('recipient'), 'test')->subject(Input::get('title'));
         });
     }
     return Redirect::to('/user/messages');
 }
Example #15
0
 public function postNew()
 {
     $validation = new Validators\SeatUserRegisterValidator();
     if ($validation->passes()) {
         // Let's register a user.
         $user = new \User();
         $user->email = Input::get('email');
         $user->username = Input::get('username');
         $user->password = Hash::make(Input::get('password'));
         $user->tsid = Input::get('tsid');
         $user->activation_code = str_random(24);
         $user->activated = 1;
         $user->save();
         // Prepare data to be sent along with the email. These
         // are accessed by their keys in the email template
         $data = array('activation_code' => $user->activation_code);
         // Send the email with the activation link
         Mail::send('emails.auth.register', $data, function ($message) {
             $message->to(Input::get('email'), 'New SeAT User')->subject('SeAT Account Confirmation');
         });
         // And were done. Redirect to the login again
         return Redirect::action('SessionController@getSignIn')->with('success', 'Successfully registered a new account. Please check your email for the activation link.');
     } else {
         return Redirect::back()->withInput()->withErrors($validation->errors);
     }
 }
Example #16
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof ModelNotFoundException) {
         $e = new NotFoundHttpException($e->getMessage(), $e);
     }
     if (config('app.debug')) {
         return parent::render($request, $e);
     }
     if ($e instanceof TokenMismatchException) {
         return redirect()->back()->withInput($request->except('_token'))->withErrors('A sua sessão expirou. Tente novamente.');
     }
     if (!$this->isHttpException($e)) {
         $pathInfo = $request->getPathInfo();
         $url = $request->url();
         $method = $request->method();
         $message = $e->getMessage() ?: get_class($e);
         $data = ['pathInfo' => $pathInfo, 'url' => $url, 'method' => $method, 'exception' => $message, 'input' => $request->all()];
         \Mail::send('emails.notify-webmaster', $data, function ($message) use($url) {
             $message->from('*****@*****.**');
             $message->to('*****@*****.**', 'André Ascensão');
             $message->subject("Exception at {$url}");
         });
     }
     return parent::render($request, $e);
 }
Example #17
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $account = new Account();
     $account->setDomain(Input::get('domain'));
     $account->setNit(Input::get('nit'));
     $account->setName(Input::get('name'));
     $account->setEmail(Input::get('email'));
     // return $account->getErrorMessage();
     if ($account->Guardar()) {
         //redireccionar con el mensaje a la siguiente vista
         Session::flash('mensaje', $account->getErrorMessage());
         $direccion = "http://" . $account->domain . ".emizor.com";
         //enviando correo de bienvenida
         global $correo;
         $correo = $account->getEmail();
         // return Response::json($correo);
         Mail::send('emails.bienvenida', array('direccion' => $direccion, 'name' => $account->getName(), 'nit' => $account->getNit()), function ($message) {
             global $correo;
             $message->to($correo, '')->subject('Emizor');
         });
         //
         // $direccion = "/crear/sucursal";
         return Redirect::to($direccion);
     }
     Session::flash('error', $account->getErrorMessage());
     return Redirect::to('crear');
 }
 public function notify($user, $data)
 {
     \Mail::send($data['mail_template'], $data, function ($m) use($user, $data) {
         $m->to($user->email, $user->first_name);
         $m->subject($data['subject']);
     });
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $expiring_assets = Asset::getExpiringWarrantee(60);
     $data['count'] = count($expiring_assets);
     $data['email_content'] = '';
     foreach ($expiring_assets as $asset) {
         $now = date("Y-m-d");
         $expires = $asset->warrantee_expires();
         $difference = round(abs(strtotime($expires) - strtotime($now)) / 86400);
         if ($difference > 30) {
             $data['email_content'] .= '<tr style="background-color: #fcffa3;">';
         } else {
             $data['email_content'] .= '<tr style="background-color:#d9534f;">';
         }
         $data['email_content'] .= '<td><a href="' . Config::get('app.url') . '/hardware/' . $asset->id . '/view">';
         $data['email_content'] .= $asset->name . '</a></td><td>' . $asset->asset_tag . '</td>';
         $data['email_content'] .= '<td>' . $asset->warrantee_expires() . '</td>';
         $data['email_content'] .= '<td>' . $difference . ' days</td>';
         $data['email_content'] .= '</tr>';
     }
     if (Setting::getSettings()->alert_email != '' && Setting::getSettings()->alerts_enabled == 1) {
         if (count($expiring_assets) > 0) {
             Mail::send('emails.expiring-report', $data, function ($m) {
                 $m->to(Setting::getSettings()->alert_email, Setting::getSettings()->site_name);
                 $m->subject('Expiring Assets Report');
             });
         }
     } else {
         if (Setting::getSettings()->alert_email == '') {
             echo "Could not send email. No alert email configured in settings. \n";
         } elseif (Setting::getSettings()->alerts_enabled != 1) {
             echo "Alerts are disabled in the settings. No mail will be sent. \n";
         }
     }
 }
Example #20
0
 /**
  * Show the form for creating a new resource.
  * POST /account/create
  *
  * @return Response
  */
 public function create()
 {
     //perform Register Action
     $rules = ['email' => 'required|email|unique:users', 'password' => 'required|min:6'];
     $v = Validator::make(Input::all(), $rules);
     if ($v->fails()) {
         return Redirect::route('register')->withErrors($v)->withInput();
     } else {
         $users = new User();
         $users->first_name = Input::get('fname');
         $users->last_name = Input::get('lname');
         $users->username = Input::get('username');
         $users->email = Input::get('email');
         $users->password = Hash::make(Input::get('password'));
         $send = $users->save();
         if ($send) {
             Mail::send('emails.activation', array('key' => Crypt::encrypt(Input::get('email'))), function ($message) {
                 $message->to(Input::get('email'), Input::get('fname') . ' ' . Input::get('lname'))->subject('Welcome! Please Activate Your Account');
             });
             $newUser = User::find($users->id);
             Auth::login($newUser);
             return Redirect::to('home');
         }
     }
 }
 /**
  * This function create employee
  * when data is posted from 
  * /admin/employee/create
  */
 public function postCreate()
 {
     // Check validation
     $validator = Validator::make(Input::all(), Employee::$rulesForCreate, Employee::$messages);
     // If failed then redirect to employee-create-get route with
     // validation error and input old
     if ($validator->fails()) {
         return Redirect::route('employee-create-get')->withErrors($validator)->withInput();
     }
     // If validation is not failed then create employee
     $employee = Employee::create(array('first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'age' => Input::get('age'), 'gender' => Input::get('gender'), 'DOB' => DateFormat::store(Input::get('DOB')), 'present_address' => Input::get('present_address'), 'permanent_address' => Input::get('permanent_address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'country' => Input::get('country'), 'mobile_no' => Input::get('mobile_no'), 'email' => Input::get('email'), 'created_by' => Session::get('username')));
     // Also create user account for the employee
     $user = User::create(array('details_id' => $employee->id, 'username' => Input::get('username'), 'email' => $employee->email, 'user_level' => Input::get('userlevel'), 'active' => 0));
     // generate random code and password
     $password = str_random(10);
     $code = str_random(60);
     $newHashPassword = Hash::make($password);
     // Save new password and code
     $user->password_tmp = $newHashPassword;
     $user->activation_code = $code;
     if ($user->save()) {
         // Send email to the employee.
         // This email contains username,password,activation link
         Mail::send('emails.auth.activation', array('first_name' => $employee->first_name, 'last_name' => $employee->last_name, 'username' => $user->username, 'password' => $password, 'activation_link' => URL::route('activation-get', $code)), function ($message) use($user) {
             $message->to($user->email, $user->username)->subject('Confirm Activation');
         });
     }
     return View::make('adminArea.employee.create')->with('success', 'Activation link has been sent successfully');
 }
Example #22
0
 /**
  * Hook comment publishing
  *
  * @param object $Comment
  * @param object $Post
  * @param object $Parent
  * @param object $ParentAuthor
  */
 public function hookCommentPublished($Comment, $Post, $Parent = NULL, $ParentAuthor = NULL)
 {
     // If you post comment to your post
     if ($Post->aid != $Comment->aid) {
         $replace = array('$user_link%' => $this->user->getLink(), '%user_name%' => $this->user->getName(), '%post_link%' => $Post->getLink(), '%post_name%' => $Post->name, '%comment%' => $Comment->body, '%reply_link%' => $Post->getLink() . '#comment-' . $Comment->id);
         $mail = new Mail(array('name' => 'comment.post', 'subject' => t('New comment to your post', 'Mail.templates'), 'body' => str_replace(array_keys($replace), array_values($replace), t('User <a href="%user_link%">%user_name%</a> has published a comment to your post <a href="%post_link%">"%post_name%"</a>:
                         <p><i>%comment%</i></p>
                         <p><a href="%reply_link%">Reply &rarr;</a></p>'))));
         if ($PostAuthor = user($Post->aid)) {
             $mail->to($PostAuthor->email);
             $mail->send();
         }
     }
     /**
      * If you reply and not to yourself
      */
     if ($Parent && $Parent->aid != $this->user->id) {
         $replace = array('$user_link%' => $this->user->getLink(), '%user_name%' => $this->user->getName(), '%post_link%' => $Post->getLink(), '%post_name%' => $Post->name, '%comment%' => $Comment->body, '%reply_link%' => $Post->getLink() . '#comment-' . $Comment->id);
         $mail = new Mail(array('name' => 'comment.reply', 'subject' => t('Reply for your comment', 'Mail.templates'), 'body' => str_replace(array_keys($replace), array_values($replace), t('User <a href="%user_link%">%user_name%</a> has answered for you comment to post <a href="%post_link%">"%post_name%"</a>:
                         <p><i>%comment%</i></p>
                         <p><a href="%reply_link%">Reply &rarr;</a></p>', 'Mail.templates'))));
         $mail->to($ParentAuthor->email);
         $mail->send();
     }
     unset($mail);
 }
 public function validate()
 {
     $this->language->load('module/ULTIMATUMcontactform');
     $json = array();
     if (strlen($this->request->post['ULTIMATUMcontactform_email']) > 96 || !preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $this->request->post['ULTIMATUMcontactform_email'])) {
         $json['error']['warning'] = $this->language->get('error_email');
     } elseif (strlen($this->request->post['ULTIMATUMcontactform_message']) < 3) {
         $json['error']['warning'] = $this->language->get('error_message');
     }
     if ($this->config->get('ULTIMATUMcontactform_captcha')) {
         if ($this->request->post['captcha'] != $this->session->data['captcha']) {
             $json['error']['warning'] = $this->language->get('error_captcha');
         }
     }
     if (!$json) {
         $mail = new Mail();
         $mail->protocol = $this->config->get('config_mail_protocol');
         $mail->parameter = $this->config->get('config_mail_parameter');
         $mail->hostname = $this->config->get('config_smtp_host');
         $mail->username = $this->config->get('config_smtp_username');
         $mail->password = $this->config->get('config_smtp_password');
         $mail->port = $this->config->get('config_smtp_port');
         $mail->timeout = $this->config->get('config_smtp_timeout');
         $mail->setTo($this->config->get('config_email'));
         $mail->setFrom($this->request->post['ULTIMATUMcontactform_email']);
         $mail->setSender($this->request->post['ULTIMATUMcontactform_email']);
         $mail->setSubject(html_entity_decode($this->language->get('email_subject'), ENT_QUOTES, 'UTF-8'));
         $mail->setText(strip_tags(html_entity_decode($this->request->post['ULTIMATUMcontactform_message'], ENT_QUOTES, 'UTF-8')));
         $mail->send();
         $json['success'] = $this->language->get('success');
     }
     $this->response->setOutput(json_encode($json));
 }
 private function sendNotification($email, $description, $product_id)
 {
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->hostname = $this->config->get('config_smtp_host');
     $mail->username = $this->config->get('config_smtp_username');
     $mail->password = $this->config->get('config_smtp_password');
     $mail->port = $this->config->get('config_smtp_port');
     $mail->timeout = $this->config->get('config_smtp_timeout');
     $mail->setTo($email);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $this->language->load('account/notify_customer_about_stock');
     $subject = $this->language->get('text_mail_subject');
     $message = $this->language->get('text_hello') . "<br><br>";
     $message .= $this->language->get('text_product_you_are_looking') . " - <strong>";
     $message .= $description;
     $message .= " - </strong>" . $this->language->get('text_reached_in_stock') . "<br>";
     $message .= $this->language->get('text_you_can_visit') . "<br>";
     $message .= '<a href="' . $this->url->link('product/product', 'product_id=' . $product_id) . '">' . $this->url->link('product/product', 'product_id=' . $product_id) . '</a><br>';
     $message .= $this->language->get('text_to_order') . "<br><br>";
     $message .= $this->language->get('text_best_regards') . "<br>";
     $message .= $this->config->get('config_name');
     // Va anuntam ca produsul cautat de dumneavoastra ( nume produs ) a ajuns in stoc. Puteti vizita ( pagina produsului ) pentru a-l comanda.
     $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
     $mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
 }
Example #25
0
 public function sendMail($template, $email, $name, $data = array())
 {
     \Mail::send($template, $data, function ($message) use($data, $email, $name) {
         $subject = isset($data['subject']) ? $data['subject'] : 'Welcome!';
         $message->to($email, $name)->subject($subject);
     });
 }
Example #26
0
 public function renew()
 {
     $validaciones = Usuario::validacionesrenew(Input::all());
     if ($validaciones->fails()) {
         return Redirect::to('/')->withErrors($validaciones)->withInput();
     } else {
         $data = Input::all();
         $usuario = Usuario::where('login', '=', $data['email'])->get();
         if ($usuario->count() == 1) {
             $email = $usuario[0]->email;
             $hashed = trim(substr(Hash::make((string) rand(0, 999)), -6));
             $datos = array('clave' => Hash::make($hashed));
             $user = Usuario::where('login', '=', $email)->update($datos);
             $data = ['msj' => 'Nos complace anunciarte que la recuperación de tu clave has sido exitosa', 'email' => $usuario[0]->email, 'nombre' => $usuario[0]->nombre, 'clave' => $hashed];
             Mail::send('emails.renew', $data, function ($message) use($usuario) {
                 $message->from('*****@*****.**');
                 $message->to($usuario[0]->email, $usuario[0]->name)->subject('Recuperación de Clave!');
             });
             Session::flash('message', 'La restauración de la clave ha sido enviada a su correo');
             Session::flash('class', 'success');
         } else {
             Session::flash('message', 'El correo electrónico no está registrado');
             Session::flash('class', 'danger');
         }
         return Redirect::to('/');
     }
 }
 public static function sendEmail($email, $messageBody, $emailView, $subject)
 {
     Mail::send($emailView, ['messageBody' => $messageBody], function ($message) use($email, $subject) {
         $message->from(static::COMPANY_FROM_EMAIL, static::COMPANY_FROM_NAME);
         $message->to($email, '')->subject($subject);
     });
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::only(['name', 'rank', 'email', 'myMessage', 'g-recaptcha-response']);
     $google_url = "https://www.google.com/recaptcha/api/siteverify";
     $secret = Config::get('recaptcha.secret_key');
     $url = $google_url . "?secret=" . $secret . "&response=" . $data['g-recaptcha-response'];
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $url);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl, CURLOPT_TIMEOUT, 10);
     curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16");
     $curlData = curl_exec($curl);
     curl_close($curl);
     $response = json_decode($curlData, true);
     if ($response['success'] == true) {
         $rules = array('name' => 'required|min:3|max:100', 'rank' => 'required|min:3|max:50', 'email' => 'required|email|unique:users|unique:invitations', 'myMessage' => 'required|min:5|max:300');
         $validator = Validator::make($data, $rules);
         if ($validator->fails()) {
             return Redirect::route('admin.request.index')->withErrors($validator->messages());
         } else {
             Mail::send('emails.auth.request', $data, function ($message) {
                 $message->to('*****@*****.**', 'РегистърБГ')->subject('Нова заявка за покана в РегистърБГ');
                 $message->to('*****@*****.**', 'РегистърБГ')->subject('Нова заявка за покана в РегистърБГ');
             });
             if (count(Mail::failures()) > 0) {
                 return Redirect::route('admin.request.index')->withErrors(array('mainError' => 'Възникна грешка при изпращане на имейл. Моля опитайте по-късно.'));
             }
             return Redirect::route('admin.request.index')->withErrors(array('mainSuccess' => 'Заявката е успшно изпратена. Възможно най-бързо ще получите обратна връзка.'));
         }
     }
     return Redirect::route('admin.request.index')->withErrors(array('g-recaptcha-response' => 'Моля потвърдете, че не сте робот.'));
     /*return Redirect::route('admin.index');*/
 }
Example #29
0
 private function _activeUser()
 {
     $validationID = HTTP::_GP('i', 0);
     $validationKey = HTTP::_GP('k', '');
     $userData = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS_VALID . " WHERE validationID = " . $validationID . " AND validationKey = '" . $GLOBALS['DATABASE']->escape($validationKey) . "';");
     if (!isset($userData)) {
         $this->printMessage(t('vertifyNoUserFound'));
     }
     $GLOBALS['DATABASE']->query("DELETE FROM " . USERS_VALID . " WHERE validationID = " . $validationID . ";");
     list($userID, $planetID) = PlayerUtil::createPlayer($userData['universe'], $userData['userName'], $userData['password'], $userData['email'], $userData['race'], $userData['language']);
     if (Config::get('mail_active', $userData['universe']) == 1) {
         require 'includes/classes/Mail.class.php';
         $MailSubject = t('registerMailCompleteTitle', Config::get('game_name', $userData['universe']));
         $MailRAW = $GLOBALS['LNG']->getTemplate('email_reg_done');
         $MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{GAMEMAIL}'), array($userData['email'], Config::get('game_name') . ' - ' . Config::get('uni_name'), Config::get('smtp_sendmail')), $MailRAW);
         try {
             Mail::send($userData['email'], $userData['userName'], $MailSubject, $MailContent);
         } catch (Exception $e) {
             // This mail is wayne.
         }
     }
     if (!empty($userData['referralID'])) {
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET\n\t\t\t`ref_id`\t= " . $userData['referralID'] . ",\n\t\t\t`ref_bonus`\t= 1\n\t\t\tWHERE\n\t\t\t`id`\t\t= " . $userID . ";");
     }
     if (!empty($userData['externalAuthUID'])) {
         $GLOBALS['DATABASE']->query("INSERT INTO " . USERS_AUTH . " SET\n\t\t\t`id`\t\t= " . $userID . ",\n\t\t\t`account`\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthUID']) . "',\n\t\t\t`mode`\t\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthMethod']) . "';");
     }
     $nameSender = t('registerWelcomePMSenderName');
     $subject = t('registerWelcomePMSubject');
     $message = t('registerWelcomePMText', Config::get('game_name', $userData['universe']));
     SendSimpleMessage($userID, 1, TIMESTAMP, 1, $nameSender, $subject, $message);
     return array('userID' => $userID, 'userName' => $userData['userName'], 'planetID' => $planetID);
 }
 public function sendPassFormSubmitted($form)
 {
     $values = $form->getValues();
     $user = $this->model->findByEmail($values['email']);
     if (!$user->id) {
         //			$this->flashMessage('Účet so zadaným e-mailom neexistuje', self::FLASH_MESSAGE_ERROR);
         $this->flashMessage('Provided email does not exist in the system', self::FLASH_MESSAGE_ERROR);
         $this->redirect('this');
     } else {
         $token = $this->model->allowTemporaryLogin($user->id, $values['email'], $this->tempLoginTokenExpiration);
         // send email with url for temporary login
         try {
             $email_template = $this->createTemplate();
             $email_template->setFile(__DIR__ . '/../templates/email.phtml');
             $email_template->completeName = $user->completeName;
             $email_template->tempLoginUri = $this->link('//tempLogin', array('tempLoginToken' => $token));
             $mail = new Mail();
             $mail->setFrom(Environment::getConfig("contact")->forgottenPassEmail);
             $mail->addTo($values['email']);
             $mail->setSubject('Password Assistance');
             $mail->setHtmlBody($email_template);
             $mail->send();
         } catch (DibiDriverException $e) {
             $this->flashMessage(OPERATION_FAILED, self::FLASH_MESSAGE_ERROR);
             $this->redirect('this');
         } catch (InvalidStateException $e) {
             //				$this->flashMessage('Email sa nepodarilo odoslať, skúste znova o pár sekúnd', self::FLASH_MESSAGE_ERROR);
             $this->flashMessage('Email could NOT be sent. Please try again in a moment', self::FLASH_MESSAGE_ERROR);
             $this->redirect('this');
         }
         //			$this->flashMessage('Na zadaný e-mail boli odoslané prihlasovacie údaje', self::FLASH_MESSAGE_SUCCESS);
         $this->flashMessage('E-mail with detailed information has been sent to ' . $values['email'], self::FLASH_MESSAGE_SUCCESS);
         $this->redirect('this');
     }
 }