Esempio n. 1
0
 function m_sendMail()
 {
     $libFunc = new c_libFunctions();
     $this->ObTpl = new template();
     $this->ObTpl->set_file("TPL_VAR_CMS", MODULES_PATH . "default/templates/main/contactmail.tpl.htm");
     $this->ObTpl->set_var("TPL_VAR_NAME", $this->libFunc->m_displayContent($this->request['sName']));
     $this->ObTpl->set_var("TPL_VAR_ADDRESS1", $this->libFunc->m_displayContent($this->request['sAddress1']));
     $this->ObTpl->set_var("TPL_VAR_ADDRESS2", $this->libFunc->m_displayContent($this->request['sAddress2']));
     $this->ObTpl->set_var("TPL_VAR_PHONE", $this->libFunc->m_displayContent($this->request['sWorkPhone']));
     $this->ObTpl->set_var("TPL_VAR_COUNTRY", $this->libFunc->m_displayContent($this->request['sCountry']));
     $this->ObTpl->set_var("TPL_VAR_COMMENTS", nl2br($this->libFunc->m_displayContent($this->request['sComments'])));
     $message = "========================================<br />";
     $message .= "Contact request from " . SITE_NAME . "<br />";
     $message .= "========================================<br />";
     $message .= $this->ObTpl->parse("return", "TPL_VAR_CMS");
     $this->request['sName'] . "<" . $this->libFunc->m_displayContent1($this->request['sEmail']) . ">";
     $obMail = new htmlMimeMail();
     $obMail->setReturnPath(ADMIN_EMAIL);
     $this->libFunc->m_displayContent($this->request['sName']) . "<" . $this->libFunc->m_displayContent1($this->request['sEmail']) . ">";
     $obMail->setFrom($this->libFunc->m_displayContent1("\"" . $this->request['sName'] . "\"") . "<" . $this->libFunc->m_displayContent1($this->request['sEmail']) . ">");
     $obMail->setSubject("Contact request from " . SITE_NAME);
     $obMail->setCrlf("\n");
     //to handle mails in Outlook Express
     $htmlcontent = $message;
     $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
     $obMail->setHtml($htmlcontent, $txtcontent);
     $obMail->buildMessage();
     $result = $obMail->send(array(ENQUIRY_EMAIL));
 }
Esempio n. 2
0
 function m_reviewAdd()
 {
     $this->request['display'] = $this->libFunc->ifSet($this->request, "display");
     $timestamp = time();
     $this->obDb->query = "SELECT iProdid_PK FROM " . PRODUCTS . " WHERE iProdid_PK='" . $this->request['productid'] . "'";
     $rs = $this->obDb->fetchQuery();
     if ($this->obDb->record_count > 0) {
         #inserting to departments
         $this->obDb->query = "SELECT iCustRevid_PK FROM " . REVIEWS . " WHERE iCustomerid_FK='" . $_SESSION['userid'] . "' AND iItemid_FK='" . $this->request['productid'] . "'";
         $rs = $this->obDb->fetchQuery();
         $rsCnt = $this->obDb->record_count;
         if ($rsCnt == 0) {
             $this->obDb->query = "INSERT INTO " . REVIEWS . "\n\t\t\t\t\t\t\t\t\t\t(vTitle,vComment,vRank,iDisplay,iItemid_FK,tmDateAdd,iCustomerid_FK,iState) \n\t\t\t\t\t\t\t\t\t\t\tvalues('" . $this->libFunc->m_addToDB($this->request['title']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['comment']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['rank']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->request['display'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->request['productid'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'{$timestamp}','" . $_SESSION['userid'] . "',1)";
             $this->obDb->updateQuery();
         } else {
             $this->obDb->query = "UPDATE " . REVIEWS . " SET vTitle='" . $this->libFunc->m_addToDB($this->request['title']) . "',\n\t\t\t\t\t\t\t\t\t\tvComment='" . $this->libFunc->m_addToDB($this->request['comment']) . "',\n\t\t\t\t\t\t\t\t\t\tvRank='" . $this->libFunc->m_addToDB($this->request['rank']) . "',\n\t\t\t\t\t\t\t\t\t\tiDisplay='" . $this->request['display'] . "',\n\t\t\t\t\t\t\t\t\t\tiItemid_FK='" . $this->request['productid'] . "',\n\t\t\t\t\t\t\t\t\t\ttmDateAdd='{$timestamp}' WHERE iCustRevid_PK='" . $rs[0]->iCustRevid_PK . "'";
             $this->obDb->updateQuery();
         }
         # additional functionality to e-mail admin on new submission of new product review - MCB, 26/09/2008
         $this->obDb->query = "SELECT vFirstName, vLastName FROM " . CUSTOMERS . " WHERE iCustmerid_PK=" . $_SESSION['userid'];
         $name_row = $this->obDb->fetchQuery();
         $customername = $name_row[0]->vFirstName . " " . $name_row[0]->vLastName;
         $obMail = new htmlMimeMail();
         $obMail->setReturnPath(ADMIN_EMAIL);
         $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
         $obMail->setSubject("New product review");
         $obMail->setCrlf("\n");
         //to handle mails in Outlook Express
         $message = "Somebody has posted a new product review on your on-line store.<br>Details of this review are listed below.<br><br>";
         $message .= $customername . " submitted the following at " . date('g:ia') . " on " . date('l, d F Y') . ":<br><br>";
         $message .= $this->libFunc->m_displayContent($this->request['comment']) . "<br><br>";
         $message .= "To view this comment, please visit the following URL:<br>";
         $message .= "<a href=\"" . SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['mode'] . "\">" . SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['mode'] . "</a>";
         $htmlcontent = $message;
         $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
         $obMail->setHtml($htmlcontent, $txtcontent);
         $obMail->buildMessage();
         if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", ADMIN_EMAIL)) {
             $result = $obMail->send(array(ADMIN_EMAIL));
         }
     }
     # redirect on posting and e-mailing of comment ...
     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['seotitle']);
     $this->libFunc->m_mosRedirect($retUrl);
     exit;
 }
 public static function send($from, $to, $subject, $body, array $attachments = null, array $headers = null)
 {
     if (empty($to)) {
         Logger::trace("mail not sent: no recipients: {$subject}");
         return;
     }
     $config = Context::last()->config;
     if (empty($from)) {
         if (!($from = $config->get('modules/mail/from'))) {
             $from = "Molinos.CMS <no-reply@" . MCMS_HOST_NAME . ">";
         }
     }
     if (strstr($body, '<html>') === false) {
         $body = '<html><head><title>' . html::plain($subject) . '</title></head><body>' . $body . '</body></html>';
     }
     if (!is_array($to)) {
         $to = preg_split('/, */', $to, -1, PREG_SPLIT_NO_EMPTY);
     }
     Logger::log(sprintf('to=%s, subject=%s', join(',', $to), $subject), 'mail');
     $mail = new htmlMimeMail();
     if ('smtp' == ($transport = ($server = $config->get('modules/mail/server')) ? 'smtp' : 'mail')) {
         $mail->setSMTPParams($server);
     }
     $mail->setFrom($from);
     $mail->setSubject($subject);
     $mail->setHtml(self::fixhtml($body));
     $mail->setTextCharset('UTF-8');
     $mail->setTextEncoding('base64');
     $mail->setHTMLCharset('UTF-8');
     $mail->setHTMLEncoding('UTF-8');
     $mail->setHeadCharset('UTF-8');
     foreach ((array) $attachments as $file) {
         $mail->addAttachment($file['data'], $file['name'], $file['type']);
     }
     foreach ((array) $headers as $k => $v) {
         if (!empty($v)) {
             $mail->setHeader($k, $v);
         }
     }
     return $mail->send($to, $transport);
 }
Esempio n. 4
0
 /**
  * Replace placeholders in mail templates and send
  * e-mails.
  */
 function send_mail($mail_content, $content_data, $post_data = null)
 {
     global $text_wrap, $my_sendmail, $send_alternative_mail, $debug_mode, $sender_count, $sender_duration, $recipient_count, $recipient_duration, $txt, $remove_tags, $tplt, $configuration;
     $multiple = $this->collect_multiples($post_data);
     $mail_content = $this->replace_multiples($mail_content, $multiple);
     for ($i = 0; $i < count($mail_content); $i++) {
         /**
          * Replace placeholder with form, text (from language
          * file) and environment data
          */
         $mail_content[$i] = $this->replace_values($mail_content[$i], $post_data);
         $mail_content[$i] = $this->replace_values($mail_content[$i], $txt);
         $mail_content[$i] = $this->replace_values($mail_content[$i], $content_data);
         $mail_content[$i] = $this->replace_values($mail_content[$i], $this->get_environment_var($_SERVER));
         //$mail_content[$i] = $this->replace_values($mail_content[$i], $url);
         /**
          * Remove unselected value placeholders
          */
         $mail_content[$i] = $this->remove_values($mail_content[$i]);
         /**
          * Remove tags
          */
         // $mail_content[$i] = $this->clean_output($mail_content[$i], $remove_tags);
         /**
          * Strip slashes
          */
         $final_mail_content = stripslashes($mail_content[$i]);
         if ($this->validate_to($final_mail_content) == false) {
             continue;
         }
         /**
          * Check whether the user is allowed to send e-mails
          * with or to a certain e-mail address.
          */
         $sender = $this->get_header_info($mail_content[$i], 'From');
         $recipient = $this->get_header_info($mail_content[$i], 'To');
         // Check if recipient is blocked by domain
         if (sizeof($configuration['recipients_domains']) > 0) {
             foreach ($configuration['recipients_domains'] as $recipient_domain) {
                 $domain = '#' . preg_quote(trim($recipient_domain)) . '#';
                 if (preg_match($domain, $recipient) === 1) {
                     return array('status' => 'failed', 'message' => array(), 'mail_content' => $mail_content[$i]);
                 }
             }
         }
         if ($tplt == 'recom') {
             if ($limit = $this->check_value_limit($sender, $sender_count, $sender_duration, 4, $txt['txt_sender_expiration'])) {
                 $message[] = array('message' => $limit, 'fields' => '');
             }
             if ($limit = $this->check_value_limit($recipient, $recipient_count, $recipient_duration, 5, $txt['txt_recipient_expiration'])) {
                 $message[] = array('message' => $limit, 'fields' => '');
             }
             if (isset($message) and !empty($message)) {
                 return array('status' => 'failed', 'message' => $message);
             }
         }
         /**
          * Start attachment handling
          */
         $send_attachments = false;
         if (!empty($this->attachments) and is_array($this->attachments)) {
             $send_alternative_mail = 'yes';
             $send_attachments = true;
         }
         if (isset($configuration['attach_mail_vars']) and is_array($configuration['attach_mail_vars']) and sizeof($configuration['attach_mail_vars']) > 0) {
             $send_alternative_mail = 'yes';
             $send_attachments = true;
         }
         /**
          * Get sendmail path from php ini settings or use the
          * value of $my_sendmail.
          */
         if ($send_alternative_mail != 'yes') {
             $sendmail = @ini_get('sendmail_path');
             debug_mode($sendmail, 'ini_get()');
             if (empty($sendmail)) {
                 $sendmail = "/usr/sbin/sendmail -t ";
                 debug_mode($sendmail, 'empty($sendmail)');
             }
             if (isset($my_sendmail) and !empty($my_sendmail)) {
                 $sendmail = $my_sendmail;
                 debug_mode(array('$my_sendmail', $sendmail));
             }
             /**
              * Try to send e-mail by using popen() to access
              * sendmail.
              */
             if ($fd = @popen($sendmail, "w")) {
                 if (!@fputs($fd, $final_mail_content . "\n")) {
                     $send_alternative_mail = 'yes';
                     debug_mode(array($txt['txt_popen_error'] . ' - fputs()', gettype($fd), $fd));
                 }
                 pclose($fd);
             } else {
                 $send_alternative_mail = 'yes';
                 debug_mode(array($txt['txt_popen_error'] . ' - popen()', gettype($fd), $fd));
             }
             debug_mode($final_mail_content, 'Mail Content popen()');
         }
         /**
          * If popen() - or fputs() - fails, extract mail
          * header from the template and use the PHP  function
          * mail().
          */
         if ($send_alternative_mail == 'yes') {
             $header_info = explode("\n", $final_mail_content);
             $mail_subject = '';
             $mail_header = $this->mail_headers;
             $mail_header = join($mail_header, '|');
             unset($additional_headers);
             $attachment_headers = array();
             for ($k = 0; $k < count($header_info); $k++) {
                 $clean_header = trim($header_info[$k]);
                 if (empty($clean_header)) {
                     break;
                 }
                 if (preg_match("/^From:/i", $header_info[$k])) {
                     $mail_from = trim(preg_replace("/From:/i", '', $header_info[$k]));
                     $attachment_headers['From'] = $mail_from;
                     unset($header_info[$k]);
                     continue;
                 }
                 if (preg_match("/^To:/i", $header_info[$k])) {
                     $mail_recipient = trim(preg_replace("/^To:/i", '', $header_info[$k]));
                     unset($header_info[$k]);
                     continue;
                 }
                 if (preg_match("/^Subject:/i", $header_info[$k])) {
                     $mail_subject = trim(preg_replace("/^Subject:/i", '', $header_info[$k]));
                     unset($header_info[$k]);
                     continue;
                 }
                 if (preg_match("/^X-Form-Mail-Attachment:/i", $header_info[$k])) {
                     if (trim(str_replace('X-Form-Mail-Attachment:', '', $header_info[$k])) == 'no') {
                         $send_attachments = false;
                     }
                     unset($header_info[$k]);
                     continue;
                 }
                 if (preg_match("/^" . $mail_header . "/i", $header_info[$k], $match)) {
                     $additional_headers[] = $header_info[$k];
                     $attachment_headers[str_replace(':', '', $match[0])] = trim(preg_replace("/" . $match[0] . "/i", '', $header_info[$k]));
                     unset($header_info[$k]);
                     continue;
                 }
             }
             if (isset($header_info) and is_array($header_info)) {
                 $new_mail_content = trim(implode($header_info, "\n"));
                 $new_mail_content = str_replace("\r", '', $new_mail_content);
             } else {
                 $new_mail_content = '';
             }
             //                if (isset($additional_headers) and is_array($additional_headers)) {
             //                    $additional_headers = implode($additional_headers, "\n");
             //                } else {
             //                    $additional_headers = '';
             //                }
             /**
              * Wrap mail content (and only mail content - not
              * headers).
              */
             $new_mail_content = $this->wrap_content($new_mail_content, $text_wrap);
             /**
              * Send mail using simple mail function
              */
             if (!$send_attachments and $debug_mode != 'on' and $mail_recipient != '') {
                 //  @mail ($mail_recipient, $mail_subject, $new_mail_content, $additional_headers);
                 send_mail($mail_recipient, $mail_subject, $new_mail_content, $mail_from, $attachment_headers);
             }
             /**
              * Send mail using mail class
              */
             if ($send_attachments and $debug_mode != 'on' and $mail_recipient != '') {
                 $att = new htmlMimeMail();
                 // Switch to smtp mode
                 if ($configuration['mail_type'] == 'smtp') {
                     $type = 'smtp';
                     $smtp = $configuration['smtp'];
                     $att->setSMTPParams($smtp['host'], $smtp['port'], $smtp['helo'], $smtp['auth'], $smtp['user'], $smtp['pass']);
                 } else {
                     $type = 'mail';
                 }
                 // Register file attachments in mime class
                 foreach ($this->attachments as $file_name) {
                     $att->addAttachment($att->getFile($file_name['new']), $file_name['old']);
                 }
                 //Manage mail var attachments
                 if (isset($configuration['attach_mail_vars']) and is_array($configuration['attach_mail_vars']) and sizeof($configuration['attach_mail_vars']) > 0) {
                     foreach ($configuration['attach_mail_vars'] as $attach_type) {
                         if ($attach_type == 'vcard') {
                             $attach_config = array('mailvars' => $post_data, 'type' => G10E_ATTACH_TYPE_VCARD, 'control' => $this->control_fields);
                             if ($res = attach_mail_variables::get_content($attach_config)) {
                                 $att->addAttachment($res, 'vcard.vcf');
                             }
                         }
                         if ($attach_type == 'csv') {
                             $attach_config = array('mailvars' => $post_data, 'type' => G10E_ATTACH_TYPE_CSV, 'control' => $this->control_fields, 'csv_head' => true);
                             if ($res = attach_mail_variables::get_content($attach_config)) {
                                 $att->addAttachment($res, 'csv.csv');
                             }
                         }
                     }
                 }
                 // Register headers in mime class
                 $html = false;
                 if (isset($attachment_headers) and is_array($attachment_headers)) {
                     foreach ($attachment_headers as $key => $val) {
                         $att->setHeader($key, $val);
                         if ($key == 'Content-Type' and preg_match('#text/html#i', $val)) {
                             $att->setHtmlCharset($configuration['character_set']);
                             $att->setHtml($new_mail_content);
                             $html = true;
                         }
                     }
                 }
                 $att->setHeadCharset($configuration['character_set']);
                 $att->setSubject($mail_subject);
                 if ($html != true) {
                     $att->setTextCharset($configuration['character_set']);
                     $att->setText($new_mail_content);
                 }
                 $att->send(array($mail_recipient), $type);
             }
             debug_mode($mail_recipient, 'Mail Recipient mail()');
             debug_mode($mail_subject, 'Mail Subject mail()');
             debug_mode($new_mail_content, 'Mail Content mail()');
             debug_mode($additional_headers, 'Mail Additional Headers mail()');
         }
     }
     // -re- for
     $this->mail_content = $mail_content[0];
     return array('status' => 'ok', 'mail_content' => $this->mail_content);
 }
 function m_sendEmail()
 {
     $this->ObTpl = new template();
     $this->ObTpl->set_file("TPL_VAR_ENQUIRYEMAIL", $this->templatePath . "enquiryMail.tpl.htm");
     $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL);
     $this->ObTpl->set_var("TPL_VAR_SITENAME", SITE_NAME);
     $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY);
     $this->ObTpl->set_var("TPL_VAR_PRODUCTNAME", $this->libFunc->m_displayContent($this->request['productName']));
     $this->ObTpl->set_var("TPL_VAR_SKU", $this->libFunc->m_displayContent($this->request['sku']));
     $productUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $this->request['seoTitle']);
     $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $productUrl);
     $this->ObTpl->set_var("TPL_VAR_SKU", $this->libFunc->m_displayContent($this->request['sku']));
     $this->ObTpl->set_var("TPL_VAR_NAME", $this->libFunc->m_displayContent($this->request['custname']));
     $this->ObTpl->set_var("TPL_VAR_EMAIL", $this->libFunc->m_displayContent($this->request['email']));
     $this->ObTpl->set_var("TPL_VAR_ADDRESS1", $this->libFunc->m_displayContent($this->request['address1']));
     $this->ObTpl->set_var("TPL_VAR_ADDRESS2", $this->libFunc->m_displayContent($this->request['address2']));
     $this->ObTpl->set_var("TPL_VAR_PHONE", $this->libFunc->m_displayContent($this->request['Phone']));
     $this->ObTpl->set_var("TPL_VAR_COUNTRY", $this->libFunc->m_displayContent($this->request['sCountry']));
     $this->ObTpl->set_var("TPL_VAR_COMMENTS", nl2br($this->libFunc->m_displayContent($this->request['comments'])));
     $message = $this->ObTpl->parse("return", "TPL_VAR_ENQUIRYEMAIL");
     $obMail = new htmlMimeMail();
     $obMail->setReturnPath(ADMIN_EMAIL);
     $obMail->setFrom($this->libFunc->m_displayContent($this->request['custname']) . "<" . $this->request['email'] . ">");
     $obMail->setSubject(SITE_NAME . " Product Enquiry");
     $obMail->setCrlf("\n");
     //to handle mails in Outlook Express
     $htmlcontent = $message;
     $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
     $obMail->setHtml($htmlcontent, $txtcontent);
     $obMail->buildMessage();
     $result = $obMail->send(array(ADMIN_EMAIL));
     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=enquiry.status");
     $this->libFunc->m_mosRedirect($retUrl);
     exit;
 }
Esempio n. 6
0
/**
* If sending an html email, then these
* two variables specify the text and
* html versions of the mail. Don't
* have to be named as these are. Just
* make sure the names tie in to the
* $mail->setHtml() call further down.
*/
$text = $mail->getFile('example.txt');
$html = $mail->getFile('example.html');
/**
* Add the text, html and embedded images.
* Here we're using the third argument of
* setHtml(), which is the path to the
* directory that holds the images. By
* adding this third argument, the class
* will try to find all the images in the
* html, and auto load them in. Not 100%
* accurate, and you MUST enclose your
* image references in quotes, so src="img.jpg"
* and NOT src=img.jpg. Also, where possible,
* duplicates will be avoided.
*/
$mail->setHtml($html);
/**
* Sends the message.
*/
$mail->setFrom('Ryan <*****@*****.**>');
$mail->setSubject('Test mail');
$result = $mail->send(array('*****@*****.**'));
echo $result ? 'Mail sent!' : 'Failed to send mail';
 function m_sendPassword()
 {
     $this->obDb->query = "select iCustmerid_PK,vFirstName,vEmail,tmSignupDate FROM " . CUSTOMERS . " WHERE vEmail = '" . $this->request['email'] . "' AND iRegistered='1'";
     $qryResult = $this->obDb->fetchQuery();
     $rCount = $this->obDb->record_count;
     if (isset($this->cart)) {
         $action = "ecom/index.php?action=checkout.loginForm";
     } else {
         $action = "user/index.php?action=user.loginForm";
     }
     if ($rCount > 0) {
         $requesttime = time();
         $recoveryid = md5($qryResult[0]->iCustmerid_PK . $qryResult[0]->vFirstName . $qryResult[0]->vEmail . $qryResult[0]->tmSignupDate . $requesttime);
         $this->obDb->query = "UPDATE " . CUSTOMERS . " SET vRecovery='" . $recoveryid . "',tRequestTime='" . $requesttime . "' WHERE iCustmerid_PK='" . $qryResult[0]->iCustmerid_PK . "' AND iRegistered='1'";
         $this->obDb->updateQuery();
         //	$uniqID=uniqid (3);
         $message = "Hi " . $this->libFunc->m_displayContent($qryResult[0]->vFirstName);
         $message .= "<br><br>You requested to reset your login details for Username:&nbsp;" . $qryResult[0]->vEmail;
         $message .= "<br><br>You can do so by visiting this <a href='" . SITE_URL . "user/index.php?action=user.recover&id=" . $recoveryid . "'>link</a>.";
         $message .= "<br>If the link is not clickable, copy and paste this url into your browser: " . SITE_URL . "user/index.php?action=user.recover&id=" . $recoveryid;
         $message .= "<br>You must click the above password within 24 hours of your request or the link will be deactivated.";
         $message .= "<br><br>If you didn't request to reset your password, then please disregard this message.";
         $message .= "<br><br>Best Regards,";
         $message .= "<br><a href='" . SITE_URL . "'>" . SITE_NAME . "</a>";
         $obMail = new htmlMimeMail();
         $obMail->setReturnPath(ADMIN_EMAIL);
         $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
         $obMail->setSubject("Login details from " . SITE_NAME);
         $obMail->setCrlf("\n");
         //to handle mails in Outlook Express
         $htmlcontent = $message;
         $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
         $obMail->setHtml($htmlcontent, $txtcontent);
         $obMail->buildMessage();
         $result = $obMail->send(array($qryResult[0]->vEmail));
         $retUrl = $this->libFunc->m_safeUrl(SITE_URL . $action . "&mode=sent&msg=1");
         $this->libFunc->m_mosRedirect($retUrl);
         exit;
     } else {
         $retUrl = $this->libFunc->m_safeUrl(SITE_URL . $action . "&mode=lost&msg=2");
         $this->libFunc->m_mosRedirect($retUrl);
         exit;
     }
 }
Esempio n. 8
0
 */
$attachment = $mail->getFile('example.zip');
/*
 * Get the contents of the example text/html files.
 * Text/html data doesn't have to come from files,
 * could come from anywhere.
 */
$text = $mail->getFile('example.txt');
$html = $mail->getFile('example.html');
/*
 * Add the text, html and embedded images.
 * The name (background.gif in this case)
 * of the image should match exactly
 * (case-sensitive) to the name in the html.
 */
$mail->setHtml($html, $text);
$mail->addHtmlImage($background, 'background.gif', 'image/gif');
/*
 * This is used to add an attachment to
 * the email. Due to above, the $attachment
 * variable contains the example zip file.
 */
$mail->addAttachment($attachment, 'example.zip', 'application/zip');
/*
 * Set the return path of the message
 */
$mail->setReturnPath('*****@*****.**');
/**
 * Set some headers
 */
$mail->setFrom('"Joe" <*****@*****.**>');


	

} else {

$messageSubject = "Erie Institute of Technology - Welding Landing Page - Online Request - $first_name $last_name";

}

			$mail = new htmlMimeMail();



			$mail->setHtml($body, $body_notags);

			

			$mail->setReturnPath('*****@*****.**');



			$mail->setFrom('*****@*****.**');



			$mail->setSubject($messageSubject);


Esempio n. 10
0
/**
 * Send e-mails
 *
 * @param String $to      Recipient mail address
 * @param String $subject Subject
 * @param String $message Mail content
 * @param String $from    Sender mail address
 * @param Array  $headers Additional mail headers
 *
 * @return Bool Returs true if mail has been sent
 */
function send_mail($to, $subject, $message, $from, $headers = NULL)
{
    global $configuration;
    $mail = new htmlMimeMail();
    if ($configuration['mail_type'] == 'smtp') {
        $type = 'smtp';
        $smtp = $configuration['smtp'];
        $mail->setSMTPParams($smtp['host'], $smtp['port'], $smtp['helo'], $smtp['auth'], $smtp['user'], $smtp['pass']);
    } else {
        $type = 'mail';
    }
    // Set additional mail headers
    $html = false;
    if (is_array($headers)) {
        foreach ($headers as $name => $value) {
            $mail->setHeader($name, $value);
            if (strtolower($name) == 'content-type' and preg_match('#text/html#i', $value)) {
                $mail->setHtmlCharset($configuration['character_set']);
                $mail->setHtml($message);
                $html = true;
            }
            // Set return path
            if (strtolower($name) == 'return-path') {
                $mail->setReturnPath($value);
            }
        }
    }
    $mail->setHeadCharset($configuration['character_set']);
    $mail->setFrom($from);
    $mail->setSubject($subject);
    if ($html != true) {
        $configuration['character_set'];
        $mail->setTextCharset($configuration['character_set']);
        $mail->setText($message);
    }
    $result = $mail->send(array($to), $type);
    if ($result) {
        return true;
    }
}
 function m_sendEmail()
 {
     $this->ObTpl = new template();
     $this->ObTpl->set_file("TPL_VAR_WISHEMAIL", $this->templatePath . "wishlistEmail.tpl.htm");
     $this->ObTpl->set_block("TPL_VAR_WISHEMAIL", "TPL_PRODUCT_BLK", "product_blk");
     $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL);
     $this->ObTpl->set_var("TPL_VAR_SITENAME", SITE_NAME);
     $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY);
     $this->ObTpl->set_var("product_blk", "");
     $this->obDb->query = "SELECT vFirstName,vLastName,vEmail  FROM " . CUSTOMERS . " WHERE iCustmerid_PK ='" . $_SESSION['userid'] . "'";
     $rsCustomer = $this->obDb->fetchQuery();
     $rsCustomer[0]->vFirstName;
     $senderName = $this->libFunc->m_displayContent($rsCustomer[0]->vFirstName) . " " . $this->libFunc->m_displayContent($rsCustomer[0]->vLastName);
     $this->ObTpl->set_var("TPL_VAR_SENDERNAME", $senderName);
     $this->ObTpl->set_var("TPL_VAR_MESSAGE", nl2br($this->libFunc->m_displayContent($this->request['comment'])));
     $this->obDb->query = "SELECT iShopWishid_PK,vTitle,vQuantity,vSeoTitle,iTaxable,fPrice  FROM " . PRODUCTS . "," . WISHLIST . " WHERE iProductid_FK=iProdid_PK AND iCustomerid_FK='" . $_SESSION['userid'] . "'";
     $rowProduct = $this->obDb->fetchQuery();
     $productCount = $this->obDb->record_count;
     if ($productCount > 0) {
         for ($i = 0; $i < $productCount; $i++) {
             $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rowProduct[$i]->vSeoTitle;
             $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl));
             $this->ObTpl->set_var("TPL_VAR_ID", $this->libFunc->m_displayContent($rowProduct[$i]->iShopWishid_PK));
             $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rowProduct[$i]->vTitle));
             if ($rowProduct[$i]->iTaxable == 1) {
                 #GETTING VAT PRICE
                 $vatPercent = $this->libFunc->m_vatCalculate();
                 $vatPrice = number_format($vatPercent * $rowProduct[$i]->fPrice / 100 + $rowProduct[$i]->fPrice, 2);
                 $this->ObTpl->set_var("TPL_VAR_PRICE", $this->libFunc->m_displayContent($rowProduct[$i]->fPrice) . " (" . CONST_CURRENCY . $vatPrice . " inc. Vat)");
             } else {
                 $this->ObTpl->set_var("TPL_VAR_PRICE", $this->libFunc->m_displayContent($rowProduct[$i]->fPrice));
             }
             $this->ObTpl->parse("product_blk", "TPL_PRODUCT_BLK", true);
         }
     }
     $message = $this->ObTpl->parse("return", "TPL_VAR_WISHEMAIL");
     $obMail = new htmlMimeMail();
     $obMail->setReturnPath(ADMIN_EMAIL);
     $obMail->setFrom($this->libFunc->m_displayContent(SITE_NAME) . "<" . ADMIN_EMAIL . ">");
     $obMail->setSubject("Wishlist from " . $senderName . "  at " . SITE_NAME);
     $obMail->setCrlf("\n");
     //to handle mails in Outlook Express
     $htmlcontent = $message;
     $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
     $obMail->setHtml($htmlcontent, $txtcontent);
     $obMail->buildMessage();
     $this->obDb->query = "SELECT iWishid_PK,vEmail  FROM " . WISHEMAILS . " WHERE  iCustomerid_FK='" . $_SESSION['userid'] . "'";
     $rsWishEmail = $this->obDb->fetchQuery();
     $rsCount = $this->obDb->record_count;
     if ($rsCount > 0) {
         $toArray = array();
         for ($i = 0; $i <= $rsCount - 1; $i++) {
             $toArray[$i] = $rsWishEmail[$i]->vEmail;
         }
         $result = $obMail->send($toArray);
     }
     $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=wishlist.display&mode=dspmsg");
     $this->libFunc->m_mosRedirect($retUrl);
 }
Esempio n. 12
0
  </tr>
  <tr>
    <td align='center' style='font-family:Arial Black, Gadget, sans-serif; color:#09F; font-size:20px;'>814-868-9900</td>
  </tr>
  <tr>
    <td align='center' style='font-family:Arial, Gadget, sans-serif; color:#09F; font-size:14px;'><a href='http://www.facebook.com/erieinstituteoftechnology'>Don't forget to Follow Us on Facebook!</a></td>
  </tr>
  <tr>
    <td><img src='http://www.erieit.edu/_images/responder_foot.jpg'></td>
  </tr>
</table>";

//
			//
			//Set up Auto Responder
			
			$responder = new htmlMimeMail();
			
			$responder->setHtml($responder_body, $responder_body_notags);
			
			$responder->setReturnPath('');
			
			$responder->setFrom('Erie Institute of Technology');
			
			$responder->setSubject($responder_subject);
			
			$responder->setHeader('X-Mailer', 'HTML Mime mail class (http://www.phpguru.org)');
			
			//
			//
?>
Esempio n. 13
0
function send_mail_new($to_name, $to_email, $from_name = "", $from_email = "", $subject = "", $message, $mail_type = "", $att_ids = "", $bcc_email = "", $cc_email = "", $reply = "", $f_type = "")
{
    //require_once 'swift/lib/swift_required.php';
    global $Site_Name;
    global $AdminName;
    global $AdminMail;
    global $AdminToName;
    global $AdminToEmail;
    global $USESENDGRID;
    if ($from_name == "") {
        $from_name = $AdminName;
    }
    if ($from_email == "") {
        $from_email = $AdminMail;
    }
    if ($to_name == "") {
        $to_name = $AdminToName;
    }
    if ($to_email == "") {
        $to_email = $AdminToEmail;
    }
    $message = str_replace("\\n", "\\r\\n", $message);
    $from = "{$from_name} <{$from_email}>";
    $to = "{$to_name} <{$to_email}>";
    if ($USESENDGRID == 0) {
        $headers = "MIME-Version: 1.0\n";
        $headers .= "Content-type: text/html; charset=iso-8859-1\n";
        $headers .= "From: {$from}\n";
        if ($reply) {
            $headers .= "Reply-To: {$reply} \n";
        }
        if ($cc_email) {
            $headers .= "CC: {$cc_email} \n";
        }
        $headers .= "BCC: " . $bcc_email;
        if ($att_ids != "" && $f_type != '') {
            $mail = new htmlMimeMail();
            $mail->setSubject($subject);
            //$mail->setText($message);
            $mail->setHtml($message);
            $mail->setFrom($from);
            if ($cc_email) {
                $mail->setCc($cc_email);
            }
            if ($bcc_email) {
                $mail->setBcc($bcc_email);
            }
            if ($reply) {
                $mail->setHeader("Return-Path", $reply);
                $mail->setHeader("Reply-To", $reply);
            }
            $result = $mail->send(array($to));
            //print $result;
        } else {
            @mail($to, $subject, $message, $headers);
        }
    } else {
        global $Sendgrid_Email, $Sendgrid_Pass;
        $transport = Swift_SmtpTransport::newInstance('smtp.sendgrid.net', 25)->setUsername($Sendgrid_Email)->setPassword($Sendgrid_Pass);
        //Create the Mailer using your created Transport
        $mailer = Swift_Mailer::newInstance($transport);
        $orig_msg = $message;
        //Create a message
        $message = Swift_Message::newInstance($subject)->setFrom(array($from_email => $from_name))->setTo(array($to_email => $to_name));
        $message->setSender($from_email);
        $message->setBody($orig_msg, 'text/html');
        if ($reply) {
            $message->setReplyTo($reply);
        }
        if ($cc_email) {
            $message->setCc($cc_email);
        }
        if ($bcc_email) {
            $message->addBcc($bcc_email);
        }
        //Send the message
        $result = $mailer->send($message);
    }
}
Esempio n. 14
0
 function m_forgetPassword()
 {
     $this->obDb->query = "select iAdminid_PK,vUsername,vPassword,vEmail FROM " . ADMINUSERS . " WHERE vUsername  = '******'username']) . "' AND vEmail='" . trim($this->request['email']) . "'";
     $qryResult = $this->obDb->fetchQuery();
     $rCount = $this->obDb->record_count;
     $uniqID = uniqid(3);
     if ($rCount > 0) {
         $this->libFunc->obDb = $this->obDb;
         $this->libFunc->m_removeBans($qryResult[0]->vUsername);
         $message = "Hi " . $qryResult[0]->vUsername;
         $message .= "<br><br>Here are your login details:";
         $message .= "<br><br>Username:&nbsp;" . $qryResult[0]->vUsername;
         $message .= "<br>Password:&nbsp;" . $uniqID;
         $obMail = new htmlMimeMail();
         $obMail->setReturnPath(ADMIN_EMAIL);
         $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
         $obMail->setSubject("Login details from " . SITE_NAME);
         $obMail->setCrlf("\n");
         //to handle mails in Outlook Express
         $htmlcontent = $message;
         $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
         $obMail->setHtml($htmlcontent, $txtcontent);
         $obMail->buildMessage();
         $result = $obMail->send(array($qryResult[0]->vEmail));
         $this->obDb->query = "UPDATE " . ADMINUSERS . " SET vPassword=password('" . $uniqID . "') WHERE iAdminid_PK=" . $qryResult[0]->iAdminid_PK;
         $qryResult = $this->obDb->updateQuery();
         $this->libFunc->m_mosRedirect(SITE_URL . "adminindex.php?msg=3");
     } else {
         $this->libFunc->m_mosRedirect(SITE_URL . "adminindex.php?action=forget&msg=4");
     }
 }
Esempio n. 15
0
/**
* If sending an html email, then these
* two variables specify the text and
* html versions of the mail. Don't
* have to be named as these are. Just
* make sure the names tie in to the
* $mail->setHtml() call further down.
*/
$text = $mail->getFile('example.txt');
$html = $mail->getFile('example.html');
/**
* Add the text, html and embedded images.
* Here we're using the third argument of
* setHtml(), which is the path to the
* directory that holds the images. By
* adding this third argument, the class
* will try to find all the images in the
* html, and auto load them in. Not 100%
* accurate, and you MUST enclose your
* image references in quotes, so src="img.jpg"
* and NOT src=img.jpg. Also, where possible,
* duplicates will be avoided.
*/
$mail->setHtml($html, $text, './');
/**
* Sends the message.
*/
$mail->setFrom('Joe <*****@*****.**>');
$mail->setSubject('Test mail');
$result = $mail->send(array('postmaster@localhost'));
echo $result ? 'Mail sent!' : 'Failed to send mail';
Esempio n. 16
0
 function forgotPassword($email)
 {
     global $bigtree;
     $home_page = sqlfetch(sqlquery("SELECT `nav_title` FROM `bigtree_pages` WHERE id = 0"));
     $site_title = $home_page["nav_title"];
     $no_reply_domain = str_replace(array("http://www.", "https://www.", "http://", "https://"), "", DOMAIN);
     $email = sqlescape($email);
     $user = sqlfetch(sqlquery("SELECT * FROM bigtree_users WHERE email = '{$email}'"));
     if (!$user) {
         return false;
     }
     $hash = sqlescape(md5(md5(md5(uniqid("bigtree-hash" . microtime(true))))));
     sqlquery("UPDATE bigtree_users SET change_password_hash = '{$hash}' WHERE id = '" . $user["id"] . "'");
     $login_root = ($bigtree["config"]["force_secure_login"] ? str_replace("http://", "https://", ADMIN_ROOT) : ADMIN_ROOT) . "login/";
     $html = file_get_contents(BigTree::path("admin/email/reset-password.html"));
     $html = str_ireplace("{www_root}", WWW_ROOT, $html);
     $html = str_ireplace("{admin_root}", ADMIN_ROOT, $html);
     $html = str_ireplace("{site_title}", $site_title, $html);
     $html = str_ireplace("{reset_link}", $login_root . "reset-password/{$hash}/", $html);
     $text = "Password Reset:\n\nPlease visit the following link to reset your password:\n{$reset_link}\n\nIf you did not request a password change, please disregard this email.\n\nYou are receiving this because the address is linked to an account on {$site_title}.";
     $mailer = new htmlMimeMail();
     $mailer->setFrom('"BigTree CMS" <no-reply@' . $no_reply_domain . '>');
     $mailer->setSubject("Reset Your Password");
     $mailer->setHeader('X-Mailer', 'HTML Mime mail class (http://www.phpguru.org)');
     $mailer->setHtml($html, $text);
     $mailer->send(array($user["email"]));
     BigTree::redirect($login_root . "forgot-success/");
 }
Esempio n. 17
0
 function m_sendOrdersDetails()
 {
     $comFunc = new c_commonFunctions();
     $comFunc->obDb = $this->obDb;
     #INTIALIZING TEMPLATES
     $this->ObTpl = new template();
     $this->ObTpl->set_file("TPL_ORDERMAIL_FILE", MODULES_PATH . "order/templates/admin/orderMailDownload.tpl.htm");
     #SETTING BLOCKS
     $this->ObTpl->set_block("TPL_ORDERMAIL_FILE", "TPL_CART_BLK", "cart_blk");
     $this->ObTpl->set_block("TPL_ORDERMAIL_FILE", "TPL_DELIVERY_BLK", "delivery_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VAR_CARTPRODUCTS", "cartproduct_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_GIFTCERT_BLK", "giftcert_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_DISCOUNT_BLK", "discount_blk");
     $this->ObTpl->set_block("TPL_VAR_CARTPRODUCTS", "TPL_KIT_BLK", "kit_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_COD_BLK", "cod_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_PROMODISCOUNTS_BLK", "promodiscounts_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VOLDISCOUNTS_BLK", "volDiscounts_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_POSTAGE_BLK", "postage_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_MPOINTS_BLK", "memberpoint_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_EMPOINTS_BLK", "earnedmemberpoint_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_TMPOINTS_BLK", "totalmemberpoint_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_CARTWEIGHT_BLK", "cartWeight_blk");
     $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VAT_BLK", "vat_blk");
     #INTIALIZING
     $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_SAFEURL);
     $this->ObTpl->set_var("TPL_VAR_GRAPHICSURL", GRAPHICS_PATH);
     $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY);
     $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", "");
     #INTAILAIZING
     $this->ObTpl->set_var("delivery_blk", "");
     $this->ObTpl->set_var("cart_blk", "");
     $this->ObTpl->set_var("cartWeight_blk", "");
     $this->ObTpl->set_var("giftcert_blk", "");
     $this->ObTpl->set_var("discount_blk", "");
     $this->ObTpl->set_var("cartproduct_blk", "");
     $this->ObTpl->set_var("kit_blk", "");
     $this->ObTpl->set_var("promodiscounts_blk", "");
     $this->ObTpl->set_var("volDiscounts_blk", "");
     $this->ObTpl->set_var("postage_blk", "");
     $this->ObTpl->set_var("cod_blk", "");
     $this->ObTpl->set_var("memberpoint_blk", "");
     $this->ObTpl->set_var("earnedmemberpoint_blk", "");
     $this->ObTpl->set_var("totalmemberpoint_blk", "");
     $this->ObTpl->set_var("vat_blk", "");
     $this->ObTpl->set_var("TPL_VAR_MSG", "");
     $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", "");
     $this->ObTpl->set_var("TPL_VAR_COMPANY_DETAILS", $comFunc->m_mailFooter());
     $downloadVariable = "";
     #QUERY ORDER TABLE
     $this->obDb->query = "SELECT tmOrderDate,vPayMethod,vShipDescription,fShipTotal,";
     $this->obDb->query .= "vFirstName,vLastName,vEmail,vAddress1,vAddress2,vCity,iInvoice,";
     $this->obDb->query .= "vState,vStateName,vCountry,vZip,vCompany,vPhone,vHomepage,";
     $this->obDb->query .= "vAltName,vAltAddress1,vAltAddress2,vAltCity,vAltState,vAltCountry,";
     $this->obDb->query .= "vAltStateName,vAltZip,vAltPhone,fCodCharge,fPromoValue,";
     $this->obDb->query .= "vDiscountCode,fDiscount,iGiftcert_FK,fGiftcertTotal,fMemberPoints,";
     $this->obDb->query .= "fShipByWeightPrice,fShipByWeightKg,iSameAsBilling,";
     $this->obDb->query .= "fTaxRate,fTaxPrice,tComments,vStatus,iPayStatus,fTotalPrice,iEarnedPoints,iCustomerid_FK";
     $this->obDb->query .= " FROM " . ORDERS . " WHERE iOrderid_PK='" . $this->request['orderid'] . "'";
     $qryResult = $this->obDb->fetchQuery();
     //echo "<pre>";print_r($qryResult);exit;
     $rCount = $this->obDb->record_count;
     if ($rCount != 1) {
         $errrorUrl = SITE_URL . "index.php?action=error&mode=order";
         $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($errrorUrl));
     }
     if ($rCount > 0) {
         $this->ObTpl->set_var("TPL_VAR_INVOICE", $qryResult[0]->iInvoice);
         $this->ObTpl->set_var("TPL_VAR_ORDERDATE", $this->libFunc->dateFormat2($qryResult[0]->tmOrderDate));
         if ($qryResult[0]->vPayMethod == 'cod') {
             $vPayMethod = $comFunc->m_paymentMethod($qryResult[0]->vPayMethod, $qryResult[0]->fCodCharge);
         } else {
             $vPayMethod = $comFunc->m_paymentMethod($qryResult[0]->vPayMethod);
         }
         $this->ObTpl->set_var("TPL_VAR_PAYMENTMETHOD", $vPayMethod);
         $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", $qryResult[0]->vShipDescription);
         $this->ObTpl->set_var("TPL_VAR_ORDERSTATUS", $this->request['status']);
         if (empty($qryResult[0]->tComments)) {
             $this->ObTpl->set_var("TPL_VAR_COMMENTS", "None");
         } else {
             $this->ObTpl->set_var("TPL_VAR_COMMENTS", $qryResult[0]->tComments);
         }
         if (isset($qryResult[0]->vState) && !empty($qryResult[0]->vState)) {
             $this->obDb->query = "SELECT vStateName FROM " . STATES . " where iStateId_PK  = '" . $qryResult[0]->vState . "'";
             $row_state = $this->obDb->fetchQuery();
             $this->ObTpl->set_var("TPL_VAR_BILLSTATE", $this->libFunc->m_displayContent($row_state[0]->vStateName));
         } else {
             $this->ObTpl->set_var("TPL_VAR_BILLSTATE", $qryResult[0]->vStateName);
         }
         $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK  = '" . $qryResult[0]->vCountry . "'";
         $row_country = $this->obDb->fetchQuery();
         $this->ObTpl->set_var("TPL_VAR_BILLCOUNTRY", $this->libFunc->m_displayContent($row_country[0]->vCountryName));
         if (isset($qryResult[0]->vAltState) && !empty($qryResult[0]->vAltState)) {
             $this->obDb->query = "SELECT vStateName FROM " . STATES . " where iStateId_PK  = '" . $qryResult[0]->vAltState . "'";
             $row_state = $this->obDb->fetchQuery();
             $this->ObTpl->set_var("TPL_VAR_SHIPSTATE", $this->libFunc->m_displayContent($row_state[0]->vStateName));
         } else {
             $this->ObTpl->set_var("TPL_VAR_SHIPSTATE", $qryResult[0]->vAltStateName);
         }
         $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK  = '" . $qryResult[0]->vAltCountry . "'";
         $row_country = $this->obDb->fetchQuery();
         $this->ObTpl->set_var("TPL_VAR_SHIPCOUNTRY", $this->libFunc->m_displayContent($row_country[0]->vCountryName));
         $this->ObTpl->set_var("TPL_VAR_FIRSTNAME", $this->libFunc->m_displayContent($qryResult[0]->vFirstName));
         $this->ObTpl->set_var("TPL_VAR_LASTNAME", $this->libFunc->m_displayContent($qryResult[0]->vLastName));
         $this->ObTpl->set_var("TPL_VAR_COMPANY", "(" . $this->libFunc->m_displayContent($qryResult[0]->vCompany) . ")");
         $this->ObTpl->set_var("TPL_VAR_EMAIL", $this->libFunc->m_displayContent($qryResult[0]->vEmail));
         $this->ObTpl->set_var("TPL_VAR_ADDRESS1", $this->libFunc->m_displayContent($qryResult[0]->vAddress1));
         $this->ObTpl->set_var("TPL_VAR_ADDRESS2", $this->libFunc->m_displayContent($qryResult[0]->vAddress2));
         $this->ObTpl->set_var("TPL_VAR_CITY", $this->libFunc->m_displayContent($qryResult[0]->vCity));
         $this->ObTpl->set_var("TPL_VAR_ZIP", $this->libFunc->m_displayContent($qryResult[0]->vZip));
         $this->ObTpl->set_var("TPL_VAR_COMPANY", $this->libFunc->m_displayContent($qryResult[0]->vCompany));
         $this->ObTpl->set_var("TPL_VAR_PHONE", $this->libFunc->m_displayContent($qryResult[0]->vPhone));
         $this->ObTpl->set_var("TPL_VAR_HOMEPAGE", $this->libFunc->m_displayContent($qryResult[0]->vHomepage));
         $this->ObTpl->set_var("TPL_VAR_MPOINTS", "");
         if ($this->libFunc->ifSet($_SESSION, "cssSelectedFile", "")) {
             $this->ObTpl->set_var("TPL_VAR_CSSFILE", trim($_SESSION['cssSelectedFile']));
         } else {
             $this->ObTpl->set_var("TPL_VAR_CSSFILE", trim(DEFAULT_CSS));
         }
         $this->ObTpl->set_var("TPL_VAR_CSSFILE", "");
         if ($qryResult[0]->iSameAsBilling == 1) {
             $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", MSG_SAMEASBILLING);
         } else {
             $this->ObTpl->parse("delivery_blk", "TPL_DELIVERY_BLK");
         }
         $this->ObTpl->set_var("TPL_VAR_ALTNAME", $this->libFunc->m_displayContent($qryResult[0]->vAltName));
         $this->ObTpl->set_var("TPL_VAR_ALTADDR1", $this->libFunc->m_displayContent($qryResult[0]->vAltAddress1));
         $this->ObTpl->set_var("TPL_VAR_ALTADDR2", $this->libFunc->m_displayContent($qryResult[0]->vAltAddress2));
         $this->ObTpl->set_var("TPL_VAR_ALTCITY", $this->libFunc->m_displayContent($qryResult[0]->vAltCity));
         $this->ObTpl->set_var("TPL_VAR_ALTZIP", $this->libFunc->m_displayContent($qryResult[0]->vAltZip));
         $this->ObTpl->set_var("TPL_VAR_ALTPHONE", $this->libFunc->m_displayContent($qryResult[0]->vAltPhone));
         $this->obDb->query = "SELECT iOrderProductid_PK,iProductid_FK,iQty,iGiftwrapFK,fPrice,";
         $this->obDb->query .= "fDiscount,vTitle,vSku,iKit,tShortDescription,seo_title,iTaxable,iFreeship,vPostageNotes ";
         $this->obDb->query .= " FROM " . ORDERPRODUCTS . " WHERE iOrderid_FK='" . $this->request['orderid'] . "'";
         $rsOrderProduct = $this->obDb->fetchQuery();
         $rsOrderProductCount = $this->obDb->record_count;
         foreach ($rsOrderProduct as $key => $value) {
             $this->obDb->query = "SELECT vDownloadablefile FROM " . PRODUCTS . " WHERE iProdid_PK = '" . $rsOrderProduct[$key]->iProductid_FK . "'";
             $downloadProduct = $this->obDb->fetchQuery();
             $rsOrderProduct[$key]->vDownloadablefile = $downloadProduct[0]->vDownloadablefile;
         }
         if ($rsOrderProductCount > 0) {
             $id_rows = array();
             for ($iSup = 0; $iSup < $rsOrderProductCount; $iSup++) {
                 $id_rows[$iSup] = $rsOrderProduct[$iSup]->iProductid_FK;
             }
             #GETTING SUPPLIERS FROM PRODUCT TABLE
             $this->obDb->query = " SELECT distinct iVendorid_FK FROM " . PRODUCTS . " WHERE iVendorid_FK>0 AND iProdid_PK IN (" . implode(",", $id_rows) . ")";
             $row = $this->obDb->fetchQuery();
             $totalVendor = $this->obDb->record_count;
             if ($totalVendor > 0) {
                 $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", $totalVendor);
             } else {
                 $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", "");
             }
             $comFunc->orderId = $this->request['orderid'];
             for ($i = 0; $i < $rsOrderProductCount; $i++) {
                 $this->ObTpl->set_var("TPL_VAR_OPTIONS", "");
                 $this->ObTpl->set_var("TPL_VAR_CHOICES", "");
                 $this->ObTpl->set_var("kit_blk", "");
                 $this->ObTpl->set_var("TPL_VAR_FREESHIPMSG", "");
                 $this->ObTpl->set_var("TPL_VAR_TAXABLE", "");
                 $this->ObTpl->set_var("TPL_VAR_NOTES", "");
                 $this->price = 0;
                 #INTIALIZING
                 $this->total = 0;
                 $comFunc->orderProductId = $rsOrderProduct[$i]->iOrderProductid_PK;
                 $comFunc->qty = $rsOrderProduct[$i]->iQty;
                 $comFunc->price = $this->price;
                 $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", "");
                 ##GIFTWRAP URL
                 if ($rsOrderProduct[$i]->iGiftwrapFK != 0) {
                     $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", $comFunc->m_dspGiftWrap($rsOrderProduct[$i]->iGiftwrapFK));
                 }
                 if ($rsOrderProduct[$i]->iKit == 1) {
                     $this->obDb->query = "SELECT iKitItem_title,iProductid_FK FROM " . ORDERKITS . " WHERE  iKitId='" . $rsOrderProduct[$i]->iProductid_FK . "' AND iProductOrderid_FK='" . $rsOrderProduct[$i]->iOrderProductid_PK . "'";
                     $rsKit = $this->obDb->fetchQuery();
                     $rsKitCount = $this->obDb->record_count;
                     for ($j = 0; $j < $rsKitCount; $j++) {
                         $comFunc->kitProductId = $rsKit[$j]->iProductid_FK;
                         #GET CART OPTIONS
                         $kitOptions = $comFunc->m_orderKitProductOptions();
                         if ($kitOptions == ' ') {
                             $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", "");
                         } else {
                             $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", $kitOptions);
                         }
                         $this->ObTpl->set_var("TPL_VAR_KITTITLE", $this->libFunc->m_displayContent($rsKit[$j]->iKitItem_title));
                         $this->ObTpl->parse("kit_blk", "TPL_KIT_BLK", true);
                     }
                 } else {
                     #GET ORDERED PRODUCT OPTIONS
                     $this->ObTpl->set_var("TPL_VAR_OPTIONS", $comFunc->m_orderProductOptions());
                     #GET ORDERED PRODUCT CHOICES
                     $this->ObTpl->set_var("TPL_VAR_CHOICES", $comFunc->m_orderProductChoices());
                 }
                 # (OPTION And choice effected amount)
                 $this->price = $comFunc->price;
                 #CHECK FOR DOWNLOADABLE FILE
                 if ($qryResult[0]->vPayMethod == "mail" || $qryResult[0]->vPayMethod == "cod") {
                     if (!empty($rsOrderProduct[$i]->vDownloadablefile)) {
                         $downloadVariable = 1;
                         $this->libFunc->m_checkFileExist($rsOrderProduct[$i]->vDownloadablefile, "files");
                         if ($this->libFunc->m_checkFileExist($rsOrderProduct[$i]->vDownloadablefile, "files")) {
                             $downloadUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php?action=download&mode=" . $rsOrderProduct[$i]->iProductid_FK);
                             $this->fileLink = "<a href='" . $downloadUrl . "'>Click here to download</a>";
                             $this->ObTpl->set_var("TPL_VAR_FILELINK", $this->fileLink);
                             $this->ObTpl->parse("download_blk", "TPL_DOWNLOAD_BLK");
                         }
                     } else {
                         $this->ObTpl->set_var("TPL_VAR_FILELINK", "");
                         $this->ObTpl->parse("download_blk", "TPL_DOWNLOAD_BLK");
                     }
                 } else {
                     $this->ObTpl->set_var("TPL_VAR_FILELINK", "");
                     $this->ObTpl->parse("download_blk", "TPL_DOWNLOAD_BLK");
                 }
                 #VOLUME DISCOUNT
                 #DISCOUNT ACCORDING TO QTY
                 $vDiscountPerCartElement = number_format($rsOrderProduct[$i]->fDiscount, 2, '.', '');
                 if ($vDiscountPerCartElement > 0) {
                     $totalDiscountItem = $vDiscountPerCartElement * $rsOrderProduct[$i]->iQty;
                     $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", "Volume Discount: " . CONST_CURRENCY . $vDiscountPerCartElement . " each Total: " . CONST_CURRENCY . $totalDiscountItem . "<br />");
                     $this->volDiscount = $this->volDiscount + $totalDiscountItem;
                 }
                 $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rsOrderProduct[$i]->seo_title;
                 $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl));
                 $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rsOrderProduct[$i]->vTitle));
                 $this->ObTpl->set_var("TPL_VAR_SKU", $this->libFunc->m_displayContent($rsOrderProduct[$i]->vSku));
                 $this->price = $this->price + $rsOrderProduct[$i]->fPrice;
                 $this->ObTpl->set_var("TPL_VAR_PRICE", number_format($this->price, 2, '.', ''));
                 $this->ObTpl->set_var("TPL_VAR_QTY", $rsOrderProduct[$i]->iQty);
                 $this->totalQty += $rsOrderProduct[$i]->iQty;
                 $this->total += $rsOrderProduct[$i]->iQty * $this->price;
                 $this->ObTpl->set_var("TPL_VAR_TOTAL", number_format($this->total, 2, '.', ''));
                 $this->subTotal = $this->subTotal + $this->total;
                 if ($rsOrderProduct[$i]->iFreeship == 1) {
                     $this->ObTpl->set_var("TPL_VAR_FREESHIPMSG", "<em>" . LBL_FREEPP . "</em><br />");
                 }
                 if ($rsOrderProduct[$i]->iTaxable != 1) {
                     $this->ObTpl->set_var("TPL_VAR_TAXABLE", "<em>" . LBL_NOTAX . "</em><br />");
                 }
                 if (!empty($rsOrderProduct[$i]->vPostageNotes)) {
                     $this->ObTpl->set_var("TPL_VAR_NOTES", "Notes: " . $this->libFunc->m_displayContent($rsOrderProduct[$i]->vPostageNotes) . "<br />");
                 }
                 $this->ObTpl->parse("cartproduct_blk", "TPL_VAR_CARTPRODUCTS", true);
             }
             #END PRODUCT DISPLAY
             #******************** SUB TOTAL ****************	*************
             $this->ObTpl->set_var("TPL_VAR_SUBTOTAL", number_format($this->subTotal, 2, '.', ''));
             $this->grandTotal = $this->subTotal;
             #******************** PROMOTION CODE ************************
             if ($qryResult[0]->fPromoValue > 0) {
                 $this->ObTpl->set_var("TPL_VAR_PDISCOUNTS", number_format($qryResult[0]->fPromoValue, 2, '.', ''));
                 $this->grandTotal -= number_format($qryResult[0]->fPromoValue, 2, '.', '');
                 $this->ObTpl->parse("promodiscounts_blk", "TPL_PROMODISCOUNTS_BLK");
             }
             #******************** VOLUME DISCOUNT ************************
             if ($this->volDiscount > 0) {
                 $this->ObTpl->set_var("TPL_VAR_VOLDISCOUNT", number_format($this->volDiscount, 2, '.', ''));
                 $this->grandTotal -= $this->volDiscount;
                 $this->ObTpl->parse("volDiscounts_blk", "TPL_VOLDISCOUNTS_BLK");
             }
             #CART WEIGHT *******
             if ($qryResult[0]->fShipByWeightPrice > 0 && ISACTIVE_ITEMWEIGHT == 1) {
                 $this->ObTpl->set_var("TPL_VAR_WEIGHT", $qryResult[0]->fShipByWeightKg);
                 $this->ObTpl->set_var("TPL_VAR_WEIGHTPRICE", number_format($qryResult[0]->fShipByWeightPrice, 2, '.', ''));
                 $this->grandTotal += $qryResult[0]->fShipByWeightPrice;
                 $this->ObTpl->parse("cartWeight_blk", "TPL_CARTWEIGHT_BLK");
             }
             if ($qryResult[0]->fMemberPoints > 0) {
                 $this->ObTpl->set_var("TPL_VAR_MPOINTS", number_format($qryResult[0]->fMemberPoints, 2, '.', ''));
                 $this->grandTotal -= number_format($qryResult[0]->fMemberPoints, 2, '.', '');
                 $this->ObTpl->parse("memberpoint_blk", "TPL_MPOINTS_BLK");
             }
             # code added for getting total earned points
             if ($qryResult[0]->iEarnedPoints > 0) {
                 $this->ObTpl->set_var("TPL_VAR_EMPOINTS", number_format($qryResult[0]->iEarnedPoints));
                 $this->ObTpl->parse("earnedmemberpoint_blk", "TPL_EMPOINTS_BLK");
             }
             # code added for getting total points
             $this->obDb->query = "SELECT fMemberPoints FROM " . CUSTOMERS . " WHERE  iCustmerid_PK=" . $qryResult[0]->iCustomerid_FK;
             $rsCust = $this->obDb->fetchQuery();
             if ($rsCust[0]->fMemberPoints > 0) {
                 $this->ObTpl->set_var("TPL_VAR_TMPOINTS", number_format($rsCust[0]->fMemberPoints, 0));
                 $memberpoint_price = MPOINTVALUE * $rsCust[0]->fMemberPoints;
                 $this->ObTpl->set_var("TPL_VAR_TMPOINTS_PRICE", number_format($memberpoint_price, 2, '.', ''));
                 $this->ObTpl->parse("totalmemberpoint_blk", "TPL_TMPOINTS_BLK");
             }
             #POSTAGE CALCULATION**************************
             if ($qryResult[0]->fShipTotal > 0) {
                 $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", "Postage method (" . $qryResult[0]->vShipDescription . ")");
                 $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", CONST_CURRENCY . number_format($qryResult[0]->fShipTotal, 2, '.', ''));
                 $this->grandTotal += number_format($qryResult[0]->fShipTotal, 2, '.', '');
                 $this->ObTpl->parse("postage_blk", "TPL_POSTAGE_BLK");
             } elseif ($qryResult[0]->vShipDescription == "Free P&P") {
                 $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", $qryResult[0]->vShipDescription);
                 $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", "No Charge");
                 $this->ObTpl->parse("postage_blk", "TPL_POSTAGE_BLK");
             }
             #COD PRICE(PAYMENT GATEWAY ADDITIONAL PRICE)
             if ($qryResult[0]->fCodCharge > 0) {
                 $this->ObTpl->set_var("TPL_VAR_CODPRICE", number_format($qryResult[0]->fCodCharge, 2, '.', ''));
                 $this->grandTotal += number_format($qryResult[0]->fCodCharge, 2, '.', '');
                 $this->ObTpl->parse("cod_blk", "TPL_COD_BLK");
             }
             #CHECK FOR DISCOUNTS
             if ($qryResult[0]->fDiscount != 0) {
                 $this->ObTpl->set_var("TPL_VAR_DISCOUNTPRICE", number_format($qryResult[0]->fDiscount, 2, '.', ''));
                 $this->grandTotal -= number_format($qryResult[0]->fDiscount, 2, '.', '');
                 $this->ObTpl->parse("discount_blk", "TPL_DISCOUNT_BLK");
                 $curTime = time();
                 $this->obDb->query = "UPDATE " . DISCOUNTS . " SET iState=0 WHERE vCode='" . $qryResult[0]->vDiscountCode . "' AND tmStartDate<{$curTime} AND tmEndDate>{$curTime} AND iUseonce=1";
                 $this->obDb->updateQuery();
             }
             #CHECK FOR GIFTCERTIFICATES
             if ($qryResult[0]->fGiftcertTotal != 0) {
                 $this->grandTotal -= number_format($qryResult[0]->fGiftcertTotal, 2, '.', '');
                 $this->ObTpl->set_var("TPL_VAR_GIFTCERTPRICE", number_format($qryResult[0]->fGiftcertTotal, 2, '.', ''));
                 $this->ObTpl->parse("giftcert_blk", "TPL_GIFTCERT_BLK");
             }
             if ($qryResult[0]->fTaxPrice > 0) {
                 $this->ObTpl->set_var("TPL_VAR_TAXNAME", VAT_TAX_TEXT);
                 $this->ObTpl->set_var("TPL_VAR_VAT", number_format($qryResult[0]->fTaxRate, 2, '.', ''));
                 $this->ObTpl->set_var("TPL_VAR_VATPRICE", number_format($qryResult[0]->fTaxPrice, 2, '.', ''));
                 $this->ObTpl->parse("vat_blk", "TPL_VAT_BLK");
             }
             $this->grandTotal += number_format($qryResult[0]->fDiscount, 2, '.', '');
             $this->ObTpl->set_var("TPL_VAR_CURRENTTOTAL", number_format($qryResult[0]->fTotalPrice, 2, '.', ''));
             $this->ObTpl->parse("cart_blk", "TPL_CART_BLK");
         }
     }
     #END ORDERS IF CONDITION
     $message = $this->ObTpl->parse("return", "TPL_ORDERMAIL_FILE");
     $obMail = new htmlMimeMail();
     $obMail->setReturnPath(ADMIN_EMAIL);
     $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
     $obMail->setSubject("Thank You for your order at " . SITE_NAME);
     $obMail->setCrlf("\n");
     //to handle mails in Outlook Express
     $htmlcontent = $message;
     $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
     $obMail->setHtml($htmlcontent, $txtcontent);
     $obMail->buildMessage();
     if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", ADMIN_EMAIL)) {
         if ($downloadVariable == "1" && ($qryResult[0]->vPayMethod == "mail" || $qryResult[0]->vPayMethod == "cod")) {
             $result = $obMail->send(array($qryResult[0]->vEmail));
         }
     }
     $obMail->setSubject("Thank You for your order at " . SITE_NAME);
     $this->ObTpl->set_var("customer_blk", "");
     $this->ObTpl->parse("admin_blk", "TPL_ADMIN_BLK");
     $obMail->setSubject(SITE_NAME . " Invoice " . $qryResult[0]->iInvoice);
     $obMail->setCrlf("\n");
     //to handle mails in Outlook Express
     $message = $this->ObTpl->parse("return", "TPL_ORDERMAIL_FILE");
     $htmlcontent = $message;
     $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
     $obMail->setHtml($htmlcontent, $txtcontent);
     $obMail->buildMessage();
     if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", ORDER_EMAIL)) {
         $result = $obMail->send(array(ORDER_EMAIL));
     }
     #WIRELESS EMAIL
     $Name = $this->libFunc->m_displayContent($qryResult[0]->vFirstName) . " " . $this->libFunc->m_displayContent($qryResult[0]->vLastName);
     $obMail->setSubject(SITE_NAME . " Invoice " . $qryResult[0]->iInvoice);
     $obMail->setCrlf("\n");
     //to handle mails in Outlook Express
     $wirelesscontent = "Invoice: " . $qryResult[0]->iInvoice . "<br />";
     $wirelesscontent .= "Customer: " . $Name . "<br />";
     $wirelesscontent .= "Total: " . CONST_CURRENCY . number_format($qryResult[0]->fTotalPrice, 2, '.', '');
     $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $wirelesscontent));
     $obMail->setHtml($wirelesscontent, $txtcontent);
     $obMail->buildMessage();
     if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", WIRELESS_EMAIL)) {
         $result = $obMail->send(array(WIRELESS_EMAIL));
     }
 }
 function mail_send($email_from, $subject, $sendto_email, $html_body, $plain_body, $randpath, $randfile)
 {
     $file = $html_mime_mail = new htmlMimeMail();
     $html_mime_mail->setFrom($email_from);
     $html_mime_mail->setSubject($subject);
     $html_mime_mail->setHtml($html_body, $plain_body);
     if ($randpath != '' && $randfile != '') {
         $html_mime_mail->addAttachment($html_mime_mail->getFile($randpath . $randfile), $randfile);
     }
     $success = $html_mime_mail->send(array($sendto_email), 'smtp');
     return $success;
 }
Esempio n. 19
0
 static function sendEmail($to, $subject, $html, $text = "", $from = false, $return = false, $cc = false, $bcc = false, $headers = array())
 {
     $mailer = new htmlMimeMail();
     $headers["X-Mailer"] = "BigTree CMS (http://www.bigtreecms.org) + HTML Mime mail class (http://www.phpguru.org)";
     foreach ($headers as $key => $val) {
         $mailer->setHeader($key, $val);
     }
     $mailer->setSubject($subject);
     $mailer->setHtml($html, $text);
     if (!$from) {
         $from = "no-reply@" . (isset($_SERVER["HTTP_HOST"]) ? str_replace("www.", "", $_SERVER["HTTP_HOST"]) : str_replace(array("http://www.", "https://www.", "http://", "https://"), "", DOMAIN));
     }
     $mailer->setFrom($from);
     if ($return) {
         $mailer->setReturnPath($return);
     }
     if ($cc) {
         $mailer->setCc(is_array($cc) ? $cc : array($cc));
     }
     if ($bcc) {
         $mailer->setBcc(is_array($bcc) ? $bcc : array($bcc));
     }
     return $mailer->send(is_array($to) ? $to : array($to));
 }
Esempio n. 20
0
//  $oMail->setHTMLCharset("utf-8");
//  $oMail->setHeadCharset("utf-8");

    $cTexto = $oMail->getFile("./Newsletter/Newsletter.txt");
    $cTexto = str_replace("##Contenido##", $cContTexto, $cTexto);
    $cTexto = str_replace("##Nombre##", $aRegistro["NwsSuscNombre"], $cTexto);
    $cTexto = str_replace("##EMail##", $aRegistro["NwsSuscMail"], $cTexto);
    $cTexto = str_replace("##ClaveBaja##", md5("#".$aRegistro["NwsSuscCodigo"]."#".$aRegistro["NwsSuscMail"]."#"), $cTexto);

    $cHTML  = $oMail->getFile("./Newsletter/Newsletter.html");
    $cHTML  = str_replace("##Contenido##", $cContHTML, $cHTML);
    $cHTML  = str_replace("##Nombre##", $aRegistro["NwsSuscNombre"], $cHTML);
    $cHTML  = str_replace("##EMail##", $aRegistro["NwsSuscMail"], $cHTML);
    $cHTML  = str_replace("##ClaveBaja##", md5("#".$aRegistro["NwsSuscCodigo"]."#".$aRegistro["NwsSuscMail"]."#"), $cHTML);

    $oMail->setHtml($cHTML, $cTexto, '../');
    $oMail->setFrom($cDesdeMail);
    $oMail->setReturnPath($cRetorMail);
    $oMail->setSubject($cAsunto);
    $oMail->send(array($aRegistro["NwsSuscMail"]));

    unset($oMail);

    if ($_GET['Desde']=='EnvNews') {
      $cSql = "INSERT INTO NwsEnvio (NwsEdicCodigo, NwsSuscCodigo) VALUES (" . $_REQUEST["Codigo"] . ", " . $aRegistro["NwsSuscCodigo"] . ")";
      $nResulIns = mysql_query ($cSql) or fErrorSQL($conf["EstadoSitio"], "<br /><br /><b>Error en la consulta:</b><br />" . $cSql . "<br /><br /><b>Tipo de error:</b><br />" . mysql_error() . "<br />");
    }

    ?>
    <script language="JavaScript">
      changeCaption('EstadoEnvio', '<?php 

/*
 *
 *
 * Choose subject based on cookies
*/				
if (isset($_COOKIE["reachlocal"])){
	$messageSubject = "Erie Institute of Technology - Online Application - ReachLocal ".$_COOKIE["reachlocal"]." - $first_name $last_name";
} else {
	$messageSubject = "Erie Institute of Technology - Online Application - $first_name $last_name";
}

			$mail = new htmlMimeMail();

			$mail->setHtml($body);

			$mail->setReturnPath('*****@*****.**');

			$mail->setFrom('*****@*****.**');

			$mail->setSubject($messageSubject);

			$mail->setHeader('X-Mailer', 'HTML Mime mail class (http://www.phpguru.org)');

//SEND TO BELOW //
			
$success_response = '<h1>Thank you for Submitting an Application!</h1>Thank you for submitting an online application to Erie Institute of Technology. The next step in the enrollment process is to tour the school and pay the application fee of $25.<br><br>An Admissions Representative will be contacting you shortly. If you prefer to call for an appointment you can reach us at 814-868-9900.<br><br>We look forward to speaking with you.';

$error_response = '<h1>An error has occured!</h1><p>We are sorry for the inconvenience, you may try to submit again.</p>';
			
Esempio n. 22
0
function SendHtmlEmail($plantilla, $variables, $subject, $destino, $origen = "*****@*****.**", $imagenes = NULL, $imgdir = "img", $html = NULL)
{
    require_once 'mail.php';
    if (!$html) {
        $smarty = SmartyInit();
        $smarty->assign("variables", $variables);
        $body = $smarty->fetch($plantilla);
    } else {
        $body = $html;
    }
    $mail = new htmlMimeMail();
    // Definimos el html
    $mail->setHtml($body);
    // Comprobamos si hay imagenes embebidas en el correo
    if ($imagenes != NULL) {
        // Leemos todos los ficheros y los aadimos al correo
        foreach ($imagenes as $imagen) {
            $len = strlen($imagen);
            $extension = substr($imagen, $len - 3, 3);
            if ($extension == "gif") {
                $tipo = "image/gif";
            }
            if ($extension == "jpg") {
                $tipo = "image/jpg";
            }
            $fichero = $imgdir . "/" . $imagen;
            $temp = $mail->getFile($fichero);
            $mail->addHtmlImage($temp, $imagen, $tipo);
        }
    }
    // Definimos las cabeceras de los mensajes
    $mail->setReturnPath($origen);
    $mail->setFrom($origen);
    $mail->setSubject($subject);
    $mail->setHeader('X-Mailer', 'Correo enviado por pachecoforja.com');
    // Enviamos el correo
    $result = $mail->send(array($destino), 'smtp');
    if (!$result) {
        return $mail->errors;
    } else {
        return true;
    }
}
Esempio n. 23
0
 function m_sendMail()
 {
     $timestamp = time();
     $accounturl = $this->libFunc->m_safeUrl(SITE_URL . "user/index.php?action=user.home");
     $htmlfooter = "<br /><br />==================================================";
     $htmlfooter .= "<br />You have requested to receive emails from " . SITE_NAME . " <br />\t\tIf you do not wish to receive any emails of this nature please <br />\t\t<a href='" . $accounturl . "'>Click here</a> to be removed from our list.\n\t\t<br />";
     $htmlfooter .= "==================================================<br />";
     $this->obDb->query = "select vSid,vSubject,tHtmlMail,tTextMail,vUserList,vVisitorList FROM " . EMAILS . " WHERE iMailid_PK  = '" . $this->request['id'] . "'";
     $qryResult = $this->obDb->fetchQuery();
     $rCount = $this->obDb->record_count;
     if ($rCount > 0) {
         if (!isset($this->request['to'])) {
             if ($qryResult[0]->vUserList != "All") {
                 $this->obDb->query = "SELECT vFirstName,vEmail,iMailList FROM " . LEADLIST . "," . CUSTOMERS . "\tWHERE iCustomerid_FK=iCustmerid_PK AND iLeadId_FK='" . $qryResult[0]->vUserList . "'";
             } else {
                 $this->obDb->query = "SELECT vFirstName,vEmail,iMailList FROM " . CUSTOMERS . "\tWHERE iStatus =1 && iMailList!='0'";
             }
             $qryResult1 = $this->obDb->fetchQuery();
             $rCount1 = $this->obDb->record_count;
             if ($qryResult[0]->vVisitorList == "1") {
                 $this->obDb->query = "SELECT * FROM " . NEWSLETTERS;
                 $qryVs = $this->obDb->fetchQuery();
             }
             $start = count($qryResult1);
             $a = 0;
             if (isset($qryVs)) {
                 foreach ($qryVs as $k => $v) {
                     $qryResult1[$start]->vFirstName = "";
                     $qryResult1[$start]->vEmail = $v->vEmail;
                     $qryResult1[$start]->iMailList = 1;
                     $qryResult1[$start]->PKVisitor = $v->iSignup_PK;
                     $start = $start + 1;
                     $a = $a + 1;
                 }
                 $rCount1 = $rCount1 + $a;
             }
             $this->obDb->query = "SELECT '' as vFirstName, '' as iMailList, vEmail FROM " . NEWSLETTERS;
             $newsletters = $this->obDb->fetchQuery();
             $newsletterscount = $this->obDb->record_count;
             $totalcount = $newsletterscount + $rCount1;
             $qryResult1 = $qryResult1 + $newsletters;
             if ($totalcount > 0) {
                 for ($i = 0; $i < $rCount1; $i++) {
                     if ($qryResult1[$i]->vFirstName != '') {
                         $message = "Hi " . $qryResult1[$i]->vFirstName;
                     } else {
                         $message = "Hi Customer ";
                     }
                     if (!empty($qryResult[0]->vSid)) {
                         $message .= "<br /><br /><a href=" . SITE_URL . "sid/" . $this->libFunc->m_displayContent($qryResult[0]->vSid) . ">" . SITE_URL . "sid/" . $this->libFunc->m_displayContent($qryResult[0]->vSid) . "</a><br />";
                     }
                     $obMail = new htmlMimeMail();
                     $obMail->setReturnPath(ADMIN_EMAIL);
                     $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
                     $obMail->setSubject($qryResult[0]->vSubject);
                     $obMail->setCrlf("\n");
                     //to handle mails in Outlook Express
                     if (isset($qryResult1[$i]->PKVisitor)) {
                         $accounturl = $this->libFunc->m_safeUrl(SITE_URL . "index.php?action=contactus.unsubscribe&mode=" . $qryResult1[$i]->PKVisitor);
                         $htmlfooter = "<br /><br />==================================================";
                         $htmlfooter .= "<br />You have requested to receive emails from " . SITE_NAME . " <br />\t\tIf you do not wish to receive any emails of this nature please <br />\t\t<a href='" . $accounturl . "'>Click here</a> to be removed from our list.<br />";
                         $htmlfooter .= "==================================================<br />";
                     }
                     if ($qryResult1[$i]->iMailList != 1) {
                         $htmlcontent = $message . "<br /><br />" . $this->libFunc->m_displayContent($qryResult[0]->tTextMail);
                         $htmlcontent .= $htmlfooter;
                     } else {
                         $htmlcontent = $message . "<br />" . $this->libFunc->m_displayContent1($qryResult[0]->tHtmlMail);
                         $htmlcontent .= $htmlfooter;
                     }
                     $plaintxt = $message . "<br />" . $this->libFunc->m_displayContent($qryResult[0]->tTextMail);
                     $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $plaintxt));
                     $obMail->setHtml(nl2br($htmlcontent), $txtcontent);
                     $obMail->buildMessage();
                     $result = $obMail->send(array($qryResult1[$i]->vEmail));
                 }
             }
             $this->obDb->query = "UPDATE " . EMAILS . " SET \n\t\t\t\ttmSentDate ='{$timestamp}' \n\t\t\t\tWHERE iMailid_PK  = '" . $this->request['id'] . "'";
             $qryResult2 = $this->obDb->updateQuery();
         } elseif ($this->request['to'] == 'test') {
             $message = "Hi Admin";
             $obMail = new htmlMimeMail();
             $obMail->setReturnPath(ADMIN_EMAIL);
             $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
             $obMail->setSubject($qryResult[0]->vSubject);
             $obMail->setCrlf("\n");
             //to handle mails in Outlook Express
             if (!empty($qryResult[0]->vSid)) {
                 $message .= "<br /><br /><a href=" . SITE_URL . "sid/" . $this->libFunc->m_displayContent($qryResult[0]->vSid) . ">" . SITE_URL . "sid/" . $this->libFunc->m_displayContent($qryResult[0]->vSid) . "</a><br />";
             }
             $htmlcontent1 = $message . "<br>" . $this->libFunc->m_displayContent($qryResult[0]->tTextMail);
             $htmlcontent1 .= $htmlfooter;
             $htmlcontent2 = $message . "<br>" . $this->libFunc->m_displayContent1($qryResult[0]->tHtmlMail);
             $htmlcontent2 .= $htmlfooter;
             $plaintxt = $message . "<br>" . $qryResult[0]->tTextMail;
             $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $plaintxt));
             $obMail->setHtml(nl2br($htmlcontent1), $txtcontent);
             $obMail->buildMessage();
             $result = $obMail->send(array($this->request['email']));
             $obMail->setHtml(nl2br($htmlcontent2), $txtcontent);
             $obMail->buildMessage();
             $result = $obMail->send(array($this->request['email']));
         }
         $this->libFunc->m_mosRedirect(SITE_URL . "sales/adminindex.php?action=email.home&msg=5");
         exit;
     } else {
         $this->libFunc->m_mosRedirect(SITE_URL . "sales/adminindex.php?action=email.home&msg=6");
         exit;
     }
 }
Esempio n. 24
0
 function m_sendConfirmation()
 {
     $this->comFunc->obDb = $this->obDb;
     $this->obDb->query = "SELECT vFirstName,vLastName,vEmail  FROM " . ORDERS . " WHERE  iOrderid_PK = '" . $this->request['orderid'] . "'";
     $qryResult = $this->obDb->fetchQuery();
     $rCount = $this->obDb->record_count;
     //	$uniqID=uniqid (3);
     if ($rCount > 0) {
         $name = $this->libFunc->m_displayContent($qryResult[0]->vFirstName) . " " . $this->libFunc->m_displayContent($qryResult[0]->vLastName);
         $this->ObTpl = new template();
         $this->ObTpl->set_file("TPL_MAIL_FILE", $this->mailTemplate);
         $this->ObTpl->set_var("TPL_VAR_NAME", $name);
         $this->ObTpl->set_var("TPL_VAR_INVOICE", $this->request['invoice']);
         $this->ObTpl->set_var("TPL_VAR_METHOD", $this->request['shipper']);
         $this->ObTpl->set_var("TPL_VAR_TRACKNUM", $this->request['tracking']);
         $orderUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=checkout.receipt&mode=" . $this->request['orderid']);
         $this->ObTpl->set_var("TPL_VAR_URL", $orderUrl);
         $this->ObTpl->set_var("TPL_VAR_MAILFOOTER", $this->comFunc->m_mailFooter());
         $message = $this->ObTpl->parse("return", "TPL_MAIL_FILE");
         $obMail = new htmlMimeMail();
         $obMail->setReturnPath(ADMIN_EMAIL);
         $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">");
         #11-05-07
         $obMail->setSubject("Your order from " . SITE_NAME . " has shipped!");
         $obMail->setCrlf("\n");
         //to handle mails in Outlook Express
         $htmlcontent = $message;
         $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
         $obMail->setHtml($htmlcontent, $txtcontent);
         $obMail->buildMessage();
         $result = $obMail->send(array($qryResult[0]->vEmail));
     }
 }
Esempio n. 25
0
 function m_sendStockMail()
 {
     $this->obDb->query = "SELECT vSku,vTitle,iInventory,iUseinventory FROM " . PRODUCTS . " WHERE   iProdId_PK='" . $this->productId . "'";
     $rs = $this->obDb->fetchQuery();
     #TO CHECK STOCK CONTROL ENABLED
     if ($rs[0]->iUseinventory == 1) {
         if ($rs[0]->iInventory < 1) {
             $message = "========================================<br />";
             $message .= "Low stock levels for " . $this->libFunc->m_displayContent($rs[0]->vTitle) . "<br />";
             $message .= "========================================<br />";
             $message .= "The quantity for the following product has reached reorder levels:<br />";
             $message .= "<br>Product Code: " . $this->libFunc->m_displayContent($rs[0]->vSku);
             $message .= "<br>Product Title: " . $this->libFunc->m_displayContent($rs[0]->vTitle);
             $message .= "<br>Quantity on hand: " . $rs[0]->iInventory;
             $obMail = new htmlMimeMail();
             $obMail->setReturnPath(ADMIN_EMAIL);
             $obMail->setFrom(SITE_NAME . "<" . ORDER_EMAIL . ">");
             $obMail->setSubject("Stocks Low for " . $rs[0]->vTitle);
             $obMail->setCrlf("\n");
             //to handle mails in Outlook Express
             $htmlcontent = $message;
             $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message));
             $obMail->setHtml($htmlcontent, $txtcontent);
             $obMail->buildMessage();
             $result = $obMail->send(array(ADMIN_EMAIL));
         }
     }
 }