本文整理汇总了PHP中Sms::setUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP Sms::setUsername方法的具体用法?PHP Sms::setUsername怎么用?PHP Sms::setUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sms
的用法示例。
在下文中一共展示了Sms::setUsername方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirm
//.........这里部分代码省略.........
$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
$text = $language->get('text_received') . "\n\n";
$text .= $language->get('text_order_id') . ' ' . $order_id . "\n";
$text .= $language->get('text_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_query->row['date_added'])) . "\n";
$text .= $language->get('text_order_status') . ' ' . $order_status_query->row['name'] . "\n\n";
$text .= $language->get('text_product') . "\n";
foreach ($order_product_query->rows as $result) {
$text .= $result['quantity'] . 'x ' . $result['name'] . ' (' . $result['model'] . ') ' . html_entity_decode($this->currency->format($result['total'], $order_query->row['currency'], $order_query->row['value']), ENT_NOQUOTES, 'UTF-8') . "\n";
$order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . $result['order_product_id'] . "'");
foreach ($order_option_query->rows as $option) {
$text .= chr(9) . '-' . $option['name'] . ' ' . $option['value'] . "\n";
}
}
$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";
}
$text .= "\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";
}
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_query->row['store_name']);
$mail->setSubject($subject);
$mail->setText($text);
$mail->send();
*/
}
if ($this->config->get('config_alert_sms')) {
$message = str_replace(array('{ID}', '{DATE}', '{TIME}', '{SUM}'), array($order_id, date('d.m.Y'), date('H:i'), floatval($order_query->row['total'])), $this->config->get('config_sms_message'));
$sms = new Sms($this->config->get('config_sms_gatename'));
$sms->setTo($this->config->get('config_sms_admin_phone'));
$sms->setText($message);
$sms->setUsername($this->config->get('config_sms_gate_username'));
$sms->setPassword($this->config->get('config_sms_gate_password'));
$sms->setFrom($this->config->get('config_sms_from'));
$sms->send();
}
}
}