Exemple #1
0
 private function send_email($record)
 {
     //Use connect() method to load Swiftmailer
     $swift = email::connect();
     //From, subject
     $from = $this->site['site_email'];
     $subject = 'Testing ' . $this->site['site_name'];
     //HTML message
     $html_content = Data_template_Model::get_value('EMAIL_TESTING');
     //Replate content
     if (isset($this->sess_cus['name']) && !empty($this->sess_cus['name'])) {
         $name = $this->sess_cus['name'];
     } else {
         $name = $this->sess_cus['email'];
     }
     $html_content = str_replace('#name#', $name, $html_content);
     $test = $this->test_model->get($record['test_uid']);
     $html_content = str_replace('#test#', $test['test_title'], $html_content);
     $html_content = str_replace('#date#', $this->format_int_date($record['testing_date'], $this->site['site_short_date']), $html_content);
     $html_content = str_replace('#score#', $record['testing_score'], $html_content);
     $html_content = str_replace('#duration#', gmdate("H:i:s", $record['duration']), $html_content);
     $html_content = str_replace('#code#', $record['testing_code'], $html_content);
     $html_content = str_replace('#site#', $this->site['site_name'], $html_content);
     //Build recipient lists
     $recipients = new Swift_RecipientList();
     $recipients->addTo($this->sess_cus['email']);
     //$recipients->addTo($this->site['site_email']);
     //Build the HTML message
     $message = new Swift_Message($subject, $html_content, "text/html");
     if ($swift->send($message, $recipients, $from)) {
     } else {
     }
     // Disconnect
     $swift->disconnect();
 }
Exemple #2
0
 private function send_email($record, $member, $test)
 {
     $swift = email::connect();
     $from = $this->site['site_email'];
     $mailuser = $this->sess_cus['email'];
     $subject = 'Check Code ' . $this->site['site_name'];
     $html_content = Data_template_Model::get_value('EMAIL_CHECKCODE_USER');
     $html_content = str_replace('#date#', date('m/y/Y', strtotime('now')), $html_content);
     $html_content = str_replace('#username#', $this->sess_cus['name'], $html_content);
     $html_content = str_replace('#test#', $test['test_title'], $html_content);
     $html_content = str_replace('#description#', $record['description'] != '' ? '<p><strong>Description: ' . $record['description'] . '</strong></p>' : '', $html_content);
     $html_content = str_replace('#period#', isset($list['start_date']) && $record['start_date'] != 0 ? date('m/d/Y', $record['start_date']) : '' . (isset($list['end_date']) && $record['end_date'] != 0) ? ' ~ ' . date('m/d/Y', $record['end_date']) : 'No limit', $html_content);
     $html_content = str_replace('#no#', isset($record['qty']) ? $record['usage_qty'] + 1 . '/' . $record['qty'] : 'No limit', $html_content);
     $recipients = new Swift_RecipientList();
     $recipients->addTo($this->site['site_email']);
     $recipients->addTo($mailuser);
     if (isset($record['email']) && $record['email'] != '') {
         $recipients->addTo($record['email']);
     }
     $message = new Swift_Message($subject, $html_content, "text/html");
     if ($swift->send($message, $recipients, $from)) {
     } else {
     }
     // Disconnect
     $swift->disconnect();
 }
Exemple #3
0
 private function send_email($record, $pass)
 {
     //Use connect() method to load Swiftmailer
     $swift = email::connect();
     //From, subject
     $from = $this->site['site_email'];
     $subject = 'Register ' . $this->site['site_name'];
     //HTML message
     $html_content = Data_template_Model::get_value('EMAIL_REGISTER');
     $html_content = str_replace('#name#', $record['member_fname'] . ' ' . $record['member_lname'], $html_content);
     $html_content = str_replace('#sitename#', $this->site['site_name'], $html_content);
     $html_content = str_replace('#username#', $record['member_email'], $html_content);
     $html_content = str_replace('#password#', $pass, $html_content);
     //Build recipient lists
     $recipients = new Swift_RecipientList();
     $recipients->addTo($record['member_email']);
     //Build the HTML message
     $message = new Swift_Message($subject, $html_content, "text/html");
     if ($swift->send($message, $recipients, $from)) {
     } else {
     }
     // Disconnect
     $swift->disconnect();
 }
Exemple #4
0
 private function send_email($record)
 {
     //Use connect() method to load Swiftmailer
     $swift = email::connect();
     //From, subject
     $from = $record['txt_email'];
     $subject = Kohana::lang('contact_lang.tt_page') . ' ' . $this->site['site_name'];
     //HTML message
     $html_content = Data_template_Model::get_value('EMAIL_CONTACT', $this->get_client_lang());
     //Replate content
     $record['txt_content'] = isset($record['txt_content']) ? str_replace(array("\r\n", "\r", "\n"), "<br/>", $record['txt_content']) : '';
     $html_content = str_replace('#contact_name#', $record['txt_name'], $html_content);
     $html_content = str_replace('#contact_phone#', $record['txt_phone'], $html_content);
     $html_content = str_replace('#contact_subject#', $record['txt_subject'], $html_content);
     $html_content = str_replace('#contact_content#', $record['txt_content'], $html_content);
     //Build recipient lists
     $recipients = new Swift_RecipientList();
     $recipients->addTo($this->site['site_email']);
     //Build the HTML message
     $message = new Swift_Message($subject, $html_content, "text/html");
     if ($swift->send($message, $recipients, $from)) {
         url::redirect('contact/thanks');
         die;
     }
     //Disconnect
     $swift->disconnect();
 }
Exemple #5
0
 private function send_email($result)
 {
     //Use connect() method to load Swiftmailer
     $swift = email::connect();
     //From, subject
     $pass_random = rand(1000, 9999);
     $from = $this->site['site_email'];
     $subject = Kohana::lang('login_lang.lbl_forgotpass') . ' ' . $this->site['site_name'];
     //HTML message
     $html_content = Data_template_Model::get_value('EMAIL_FORGOTPASS', $this->get_admin_lang());
     //Replate content
     $html_content = str_replace('#name#', $result->user_name, $html_content);
     $html_content = str_replace('#username#', $result->user_name, $html_content);
     $html_content = str_replace('#sitename#', $this->site['site_name'], $html_content);
     $html_content = str_replace('#password#', $pass_random, $html_content);
     //Build recipient lists
     $recipients = new Swift_RecipientList();
     $recipients->addTo($result->user_email);
     //Build the HTML message
     $message = new Swift_Message($subject, $html_content, "text/html");
     if ($swift->send($message, $recipients, $from)) {
         $this->session->set_flash('success_msg', Kohana::lang('errormsg_lang.info_mail_change_pass'));
         $result->user_pass = md5($pass_random);
         $result->save();
     }
     //Disconnect
     $swift->disconnect();
 }
Exemple #6
0
 private function send_mail_outlook($result)
 {
     $new_pass = text::random('numeric', 8);
     if (isset($result->member_email) && !empty($result->member_email)) {
         $result->member_pw = md5($new_pass);
     }
     $result->save();
     $subject = 'Your Temporary Password for ' . $this->site['site_name'];
     require_once 'PHPMailer_v5.1/class.phpmailer.php';
     $html_content = Data_template_Model::get_value('EMAIL_FORGOTPASS');
     $name = $result->member_fname . ' ' . $result->member_lname;
     $html_content = str_replace('#name#', $name, $html_content);
     if (isset($result->member_email) && !empty($result->member_email)) {
         $html_content = str_replace('#username#', $result->member_email, $html_content);
     }
     $html_content = str_replace('#site#', substr(url::base(), 0, -1), $html_content);
     $html_content = str_replace('#sitename#', $this->site['site_name'], $html_content);
     $html_content = str_replace('#password#', $new_pass, $html_content);
     $html_content = str_replace('#EmailAddress#', $this->site['site_email'], $html_content);
     $mail = new PHPMailer(true);
     // the true param means it will throw exceptions on errors, which we need to catch
     $mail->IsSendmail();
     // telling the class to use SendMail transport
     $mail->IsHTML(true);
     $mail->IsSMTP();
     $mail->CharSet = "windows-1251";
     $mail->CharSet = "utf-8";
     try {
         // $mail->Host = 'pestest.com';
         $arr_email = explode('@', $result->member_email);
         if (isset($arr_email[1]) && $arr_email[1] == 'gmail.com') {
             $mail->Host = 'smtp.gmail.com';
             $gmail = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
             $mail->Username = $gmail[array_rand($gmail)];
             $mail->Password = '******';
             $from = $gmail[array_rand($gmail)];
             $mail->From = "*****@*****.**";
             $mail->FromName = "PesTest.com";
             $mail->Sender = "*****@*****.**";
         } else {
             $from = $this->site['site_email'];
             $mail->Host = 'pestest.com';
             $mail->Username = '******';
             //'*****@*****.**'; // SMTP username
             $mail->Password = '******';
             // SMTP password
             $mail->From = "*****@*****.**";
             $mail->FromName = "PesTest.com";
             $mail->Sender = "*****@*****.**";
         }
         $mail->SMTPSecure = 'ssl';
         // secure transfer enabled REQUIRED for Gmail
         $mail->SMTPAuth = true;
         $mail->Port = 465;
         $mail->SMTPDebug = 0;
         $mail->SetFrom($from, $subject);
         $mail->AddAddress($result->member_email);
         $mail->Subject = 'Your Temporary Password for ' . $this->site['site_name'];
         $mail->Body = $html_content;
         if ($mail->Send()) {
             if (isset($result->member_email) && !empty($result->member_email)) {
                 url::redirect('forgotpass/thanks/' . $result->uid . '/customer');
             }
             return true;
         } else {
             return false;
         }
     } catch (phpmailerException $e) {
         // echo $e->errorMessage(); //Pretty error messages from PHPMailer
     } catch (Exception $e) {
         // echo $e->getMessage(); //Boring error messages from anything else!
     }
 }