当前位置: 首页>>代码示例>>PHP>>正文


PHP Sms::setFrom方法代码示例

本文整理汇总了PHP中Sms::setFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Sms::setFrom方法的具体用法?PHP Sms::setFrom怎么用?PHP Sms::setFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sms的用法示例。


在下文中一共展示了Sms::setFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: confirm


//.........这里部分代码省略.........
         }
         $text .= "\n";
         $text .= $language->get('text_total') . "\n";
         foreach ($order_total_query->rows as $result) {
             $text .= $result['title'] . ' ' . html_entity_decode($result['text'], ENT_NOQUOTES, 'UTF-8') . "\n";
         }
         $order_total = $result['text'];
         $text .= "\n";
         if ($order_query->row['customer_id']) {
             $text .= $language->get('text_invoice') . "\n";
             $text .= $order_query->row['store_url'] . 'index.php?route=account/invoice&order_id=' . $order_id . "\n\n";
         }
         if ($order_download_query->num_rows) {
             $text .= $language->get('text_download') . "\n";
             $text .= $order_query->row['store_url'] . 'index.php?route=account/download' . "\n\n";
         }
         if ($order_query->row['comment'] != '') {
             $comment = $order_query->row['comment'] . "\n\n" . $comment;
         }
         if ($comment) {
             $text .= $language->get('text_comment') . "\n\n";
             $text .= $comment . "\n\n";
         }
         $text .= $language->get('text_footer');
         $mail = new Mail();
         $mail->protocol = $this->config->get('config_mail_protocol');
         $mail->parameter = $this->config->get('config_mail_parameter');
         $mail->hostname = $this->config->get('config_smtp_host');
         $mail->username = $this->config->get('config_smtp_username');
         $mail->password = $this->config->get('config_smtp_password');
         $mail->port = $this->config->get('config_smtp_port');
         $mail->timeout = $this->config->get('config_smtp_timeout');
         $mail->setTo($order_query->row['email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($order_query->row['store_name']);
         $mail->setSubject($subject);
         $mail->setHtml($html);
         $mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
         $mail->addAttachment(DIR_IMAGE . $this->config->get('config_logo'));
         $mail->send();
         if ($this->config->get('config_alert_mail')) {
             // HTML
             $template->data['text_greeting'] = $language->get('text_received') . "\n\n";
             $template->data['invoice'] = '';
             $template->data['text_invoice'] = '';
             if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order_confirm.tpl')) {
                 $html = $template->fetch($this->config->get('config_template') . '/template/mail/order_confirm.tpl');
             } else {
                 $html = $template->fetch('default/template/mail/order_confirm.tpl');
             }
             $subject = sprintf($language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $order_id . ' (' . $order_total . ')');
             $mail->setSubject($subject);
             $mail->setTo($this->config->get('config_email'));
             $mail->setHtml($html);
             $mail->send();
             // Send to additional alert emails
             $pattern = '/^[A-Z0-9._%-+]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\\.[A-Z]{2,6}$/i';
             $emails = explode(',', $this->config->get('config_alert_emails'));
             foreach ($emails as $email) {
                 if (strlen($email) > 0 && preg_match($pattern, $email)) {
                     $mail->setTo($email);
                     $mail->send();
                 }
             }
             /*
             // Text
开发者ID:rb2,项目名称:ocstoreru,代码行数:67,代码来源:order.php


注:本文中的Sms::setFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。