本文整理汇总了PHP中Mail::setReplyTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::setReplyTo方法的具体用法?PHP Mail::setReplyTo怎么用?PHP Mail::setReplyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::setReplyTo方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transportEmail
/**
* Transport a mail.
*
* @param string $strRecipientEmail
* @param Mail $email
*
* @return void
* @throws AvisotaTransportException
*/
public function transportEmail($recipient, Mail $email)
{
global $page;
try {
// set sender email
if ($this->config->sender) {
$email->setSender($this->config->sender);
} else {
if (isset($page) && strlen($page->adminEmail)) {
$email->setSender($page->adminEmail);
} else {
$email->setSender($GLOBALS['TL_CONFIG']['adminEmail']);
}
}
// set sender name
if (strlen($this->config->senderName)) {
$email->setSenderName($this->config->senderName);
}
// set reply email
if ($this->config->replyTo) {
$email->setReplyTo($this->config->replyTo);
}
// set reply name
if ($this->config->replyToName) {
$email->setReplyToName($this->config->replyToName);
}
$this->mailer->send($email, $recipient);
} catch (Swift_RfcComplianceException $e) {
throw new AvisotaTransportEmailException($recipient, $email, $e->getMessage(), $e->getCode(), $e);
}
}
示例2: index
public function index()
{
$data['email'] = isset($this->request->post['email']) ? $this->request->post['email'] : ($this->auth->isLogged() ? $this->auth->getEmail() : false);
$data['subject'] = isset($this->request->post['subject']) ? $this->request->post['subject'] : false;
$data['message'] = isset($this->request->post['message']) ? $this->request->post['message'] : false;
if ('POST' == $this->request->getRequestMethod() && $this->_validatePost()) {
$mail = new Mail();
$mail->setTo(MAIL_INFO);
$mail->setFrom(MAIL_FROM);
$mail->setReplyTo($this->request->post['email']);
$mail->setSender(MAIL_SENDER);
$mail->setSubject($this->request->post['subject']);
$mail->setText($this->request->post['message']);
$mail->send();
$this->session->setUserMessage(array('success' => tt('Your message was sent successfully!')));
$data['subject'] = false;
$data['message'] = false;
}
$this->document->setTitle(tt('Contact Us'));
$data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('Contact Us'), 'href' => $this->url->link('common/contact', '', 'SSL'), 'active' => true)));
$data['error'] = $this->_error;
$data['href_common_information_licenses'] = $this->url->link('common/information/licenses');
$data['href_common_information_terms'] = $this->url->link('common/information/terms');
$data['href_common_information_faq'] = $this->url->link('common/information/faq');
$data['action'] = $this->url->link('common/contact', '', 'SSL');
$data['alert_success'] = $this->load->controller('common/alert/success');
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
$this->response->setOutput($this->load->view('common/contact.tpl', $data));
}
示例3: tt
$output = ob_get_contents();
ob_end_clean();
return $output;
} else {
trigger_error('Error: Could not load template ' . $file . '!');
return false;
}
}
function tt($string)
{
return htmlentities($string);
}
// Init mail
$mail = new Mail();
$mail->setFrom(MAIL_EMAIL_SUPPORT_ADDRESS);
$mail->setReplyTo(MAIL_EMAIL_SUPPORT_ADDRESS);
$mail->setSender(MAIL_EMAIL_SENDER_NAME);
// Init Database
try {
$db = new PDO('mysql:dbname=' . DB_DATABASE . ';host=' . DB_HOSTNAME . ';charset=utf8', DB_USERNAME, DB_PASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
} catch (PDOException $e) {
$error[] = $e->getMessage();
exit;
}
// Init BitCoin
try {
$bitcoin = new BitCoin(BITCOIN_RPC_USERNAME, BITCOIN_RPC_PASSWORD, BITCOIN_RPC_HOST, BITCOIN_RPC_PORT);
} catch (Exception $e) {
$error[] = $bitcoin->error . '/' . $e->getMessage();
示例4: addOrderHistory
//.........这里部分代码省略.........
}
$data['text_download'] = '';
$data['text_footer'] = '';
$data['text_link'] = '';
$data['link'] = '';
$data['download'] = '';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) {
$html = $this->load->view($this->config->get('config_template') . '/template/mail/order.tpl', $data);
} else {
$html = $this->load->view('default/template/mail/order.tpl', $data);
}
// Text
$text = $language->get('text_new_received') . "\n\n";
$text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n";
$text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n";
$text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n";
$text .= $language->get('text_new_products') . "\n";
foreach ($order_product_query->rows as $product) {
$text .= $product['quantity'] . 'x ' . $product['name'] . ' (' . $product['model'] . ') ' . html_entity_decode($this->currency->format($product['total'] + ($this->config->get('config_tax') ? $product['tax'] * $product['quantity'] : 0), $order_info['currency_code'], $order_info['currency_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 = '" . $product['order_product_id'] . "'");
foreach ($order_option_query->rows as $option) {
if ($option['type'] != 'file') {
$value = $option['value'];
} else {
$value = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.'));
}
$text .= chr(9) . '-' . $option['name'] . ' ' . (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) . "\n";
}
}
foreach ($order_voucher_query->rows as $voucher) {
$text .= '1x ' . $voucher['description'] . ' ' . $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']);
}
$text .= "\n";
$text .= $language->get('text_new_order_total') . "\n";
foreach ($order_total_query->rows as $total) {
$text .= $total['title'] . ': ' . html_entity_decode($this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n";
}
$text .= "\n";
if ($order_info['comment']) {
$text .= $language->get('text_new_comment') . "\n\n";
$text .= $order_info['comment'] . "\n\n";
}
$mail = new Mail($this->config->get('config_mail'));
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
$mail->setReplyTo($order_info['email']);
$mail->setSender($order_info['store_name']);
$mail->setSubject($subject);
$mail->setHtml($html);
$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
$mail->send();
// Send to additional alert emails
$emails = explode(',', $this->config->get('config_mail_alert'));
foreach ($emails as $email) {
if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
$mail->setTo($email);
$mail->send();
}
}
}
}
// If order status is not 0 then send update text email
if ($order_info['order_status_id'] && $order_status_id) {
$language = new Language($order_info['language_directory']);
$language->load('default');
$language->load('mail/order');
$subject = sprintf($language->get('text_update_subject'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'), $order_id);
$message = $language->get('text_update_order') . ' ' . $order_id . "\n";
$message .= $language->get('text_update_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n\n";
$order_status_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int) $order_status_id . "' AND language_id = '" . (int) $order_info['language_id'] . "'");
if ($order_status_query->num_rows) {
$message .= $language->get('text_update_order_status') . "\n\n";
$message .= $order_status_query->row['name'] . "\n\n";
}
if ($order_info['customer_id']) {
$message .= $language->get('text_update_link') . "\n";
$message .= $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_id . "\n\n";
}
if ($notify && $comment) {
$message .= $language->get('text_update_comment') . "\n\n";
$message .= strip_tags($comment) . "\n\n";
}
$message .= $language->get('text_update_footer');
$mail = new Mail($this->config->get('config_mail'));
$mail->setTo($order_info['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_info['store_name']);
$mail->setSubject($subject);
$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
$mail->send();
}
// If order status in the complete range create any vouchers that where in the order need to be made available.
if (in_array($order_info['order_status_id'], $this->config->get('config_complete_status'))) {
// Send out any gift voucher mails
$this->load->model('checkout/voucher');
$this->model_checkout_voucher->confirm($order_id);
}
}
$this->event->trigger('post.order.history.add', $order_id);
}
示例5: sendOrder
//.........这里部分代码省略.........
} else {
$value = '';
}
}
$text .= chr(9) . '-' . $option['name'] . ' ' . (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) . "\n";
}
}
$text .= "\n";
$text .= $language->get('text_new_order_total') . "\n";
foreach ($order_total_query->rows as $total) {
$text .= $total['title'] . ': ' . html_entity_decode($this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n";
}
$text .= "\n";
if ($order_info['customer_id']) {
$text .= $language->get('text_new_link') . "\n";
$text .= $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_id . "\n\n";
}
if ($download_status) {
$text .= $language->get('text_new_download') . "\n";
$text .= $order_info['store_url'] . 'index.php?route=account/download' . "\n\n";
}
// Comment
if ($order_info['comment']) {
$text .= $language->get('text_new_comment') . "\n\n";
$text .= $order_info['comment'] . "\n\n";
}
$text .= $language->get('text_new_footer') . "\n\n";
$mail = new Mail();
$mail->setTo($order_info['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_info['store_name']);
$mail->setSubject($subject);
$mail->setHtml($html);
$mail->setText($text);
$mail->send();
// Admin Alert Mail
if ($this->config->get('config_order_mail')) {
$subject = sprintf($language->get('text_new_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $order_id);
// HTML Mail
$data['text_greeting'] = $language->get('text_new_received');
$data['text_download'] = '';
$data['text_footer'] = '';
$data['text_link'] = '';
$data['link'] = '';
$data['download'] = '';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) {
$html = $this->load->view($this->config->get('config_template') . '/template/mail/order.tpl', $data);
} else {
$html = $this->load->view('default/template/mail/order.tpl', $data);
}
// Text
$text = $language->get('text_new_received') . "\n\n";
$text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n";
$text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n";
$text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n";
$text .= $language->get('text_new_products') . "\n";
foreach ($order_product_query->rows as $product) {
$text .= $product['quantity'] . 'x ' . $product['name'] . ' (' . $product['model'] . ') ' . html_entity_decode($this->currency->format($product['total'] + ($this->config->get('config_tax') ? $product['tax'] * $product['quantity'] : 0), $order_info['currency_code'], $order_info['currency_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 = '" . $product['order_product_id'] . "'");
foreach ($order_option_query->rows as $option) {
if ($option['type'] != 'file') {
$value = $option['value'];
} else {
$value = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.'));
}
$text .= chr(9) . '-' . $option['name'] . ' ' . (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) . "\n";
}
}
$text .= "\n";
$text .= $language->get('text_new_order_total') . "\n";
foreach ($order_total_query->rows as $total) {
$text .= $total['title'] . ': ' . html_entity_decode($this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n";
}
$text .= "\n";
if ($order_info['comment']) {
$text .= $language->get('text_new_comment') . "\n\n";
$text .= $order_info['comment'] . "\n\n";
}
$mail = new Mail();
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
$mail->setReplyTo($order_info['email']);
$mail->setSender($order_info['store_name']);
$mail->setSubject($subject);
$mail->setHtml($html);
$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
$mail->send();
// Send to additional alert emails
$emails = explode(',', $this->config->get('config_mail_alert'));
foreach ($emails as $email) {
if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
$mail->setTo($email);
$mail->send();
}
}
}
// }
}
$this->event->trigger('post.order.history.add', $order_id);
}
示例6: addOrderHistory
//.........这里部分代码省略.........
// Notify admin about out of stock
$subject_text = 'Out of stock on products';
$message_text = 'There is less than ' . $this->config->get('config_stock_notify') . ' items left of: <br />';
$i = 1;
$send_notify = false;
if ($order_product_query->rows) {
foreach ($order_product_query->rows as $product_info) {
$quantity_check = $this->db->query("SELECT quantity FROM `" . DB_PREFIX . "product` WHERE product_id='" . $product_info['product_id'] . "'");
if ($quantity_check->row['quantity'] <= $this->config->get('config_stock_notify')) {
if (count($order_product_query->rows) > 1) {
$message_text .= $i . '. ' . $product_info['name'] . '<br />';
} else {
$subject_text = 'Out of stock on: ' . $product_info['name'];
$message_text .= $product_info['name'] . '<br />';
}
$send_notify = true;
}
$i++;
}
}
if ($send_notify) {
$this->load->model('setting/store');
$this->load->language('mail/customer');
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
$mail->setReplyTo($order_info['email']);
$mail->setSender('Out stock Alert');
$mail->setSubject($subject_text);
$mail->setHtml($message_text);
$mail->send();
}
// Redeem coupon, vouchers and reward points
$order_total_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int) $order_id . "' ORDER BY sort_order ASC");
foreach ($order_total_query->rows as $order_total) {
$this->load->model('total/' . $order_total['code']);
if (method_exists($this->{'model_total_' . $order_total['code']}, 'confirm')) {
$this->{'model_total_' . $order_total['code']}->confirm($order_info, $order_total);
}
}
// Add commission if sale is linked to affiliate referral.
if ($order_info['affiliate_id'] && $this->config->get('config_affiliate_auto')) {
$this->load->model('affiliate/affiliate');
$this->model_affiliate_affiliate->addTransaction($order_info['affiliate_id'], $order_info['commission'], $order_id);
}
}
// If old order status is the processing or complete status but new status is not then commence restock, and remove coupon, voucher and reward history
if (in_array($order_info['order_status_id'], array_merge($this->config->get('config_processing_status'), $this->config->get('config_complete_status'))) && !in_array($order_status_id, array_merge($this->config->get('config_processing_status'), $this->config->get('config_complete_status')))) {
// Restock
$product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int) $order_id . "'");
foreach ($product_query->rows as $product) {
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = (quantity + " . (int) $product['quantity'] . ") WHERE product_id = '" . (int) $product['product_id'] . "' AND subtract = '1'");
$option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int) $order_id . "' AND order_product_id = '" . (int) $product['order_product_id'] . "'");
foreach ($option_query->rows as $option) {
$this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET quantity = (quantity + " . (int) $product['quantity'] . ") WHERE product_option_value_id = '" . (int) $option['product_option_value_id'] . "' AND subtract = '1'");
}
}
// Get serial keys from order
$order_sk_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_serialkey WHERE order_id = '" . (int) $order_id . "'");
示例7: kitchenSink
//.........这里部分代码省略.........
$personalization2->addCc($email);
$email = new Email("Example User", "test5@example.com");
$personalization2->addBcc($email);
$email = new Email("Example User", "test6@example.com");
$personalization2->addBcc($email);
$personalization2->setSubject("Hello World from the SendGrid PHP Library");
$personalization2->addHeader("X-Test", "test");
$personalization2->addHeader("X-Mock", "true");
$personalization2->addSubstitution("%name%", "Example User");
$personalization2->addSubstitution("%city%", "Denver");
$personalization2->addCustomArg("user_id", "343");
$personalization2->addCustomArg("type", "marketing");
$personalization2->setSendAt(1443636843);
$mail->addPersonalization($personalization2);
$content = new Content("text/plain", "some text here");
$mail->addContent($content);
$content = new Content("text/html", "<html><body>some text here</body></html>");
$mail->addContent($content);
$attachment = new Attachment();
$attachment->setContent("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12");
$attachment->setType("application/pdf");
$attachment->setFilename("balance_001.pdf");
$attachment->setDisposition("attachment");
$attachment->setContentId("Balance Sheet");
$mail->addAttachment($attachment);
$attachment2 = new Attachment();
$attachment2->setContent("BwdW");
$attachment2->setType("image/png");
$attachment2->setFilename("banner.png");
$attachment2->setDisposition("inline");
$attachment2->setContentId("Banner");
$mail->addAttachment($attachment2);
$mail->setTemplateId("439b6d66-4408-4ead-83de-5c83c2ee313a");
# This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html) to work
# $mail->setBatchID("sengrid_batch_id");
$mail->addSection("%section1%", "Substitution Text for Section 1");
$mail->addSection("%section2%", "Substitution Text for Section 2");
$mail->addHeader("X-Test1", "1");
$mail->addHeader("X-Test2", "2");
$mail->addCategory("May");
$mail->addCategory("2016");
$mail->addCustomArg("campaign", "welcome");
$mail->addCustomArg("weekday", "morning");
$mail->setSendAt(1443636842);
$asm = new ASM();
$asm->setGroupId(99);
$asm->setGroupsToDisplay([4, 5, 6, 7, 8]);
$mail->setASM($asm);
$mail->setIpPoolName("23");
$mail_settings = new MailSettings();
$bcc_settings = new BccSettings();
$bcc_settings->setEnable(true);
$bcc_settings->setEmail("test@example.com");
$mail_settings->setBccSettings($bcc_settings);
$sandbox_mode = new SandBoxMode();
$sandbox_mode->setEnable(true);
$mail_settings->setSandboxMode($sandbox_mode);
$bypass_list_management = new BypassListManagement();
$bypass_list_management->setEnable(true);
$mail_settings->setBypassListManagement($bypass_list_management);
$footer = new Footer();
$footer->setEnable(true);
$footer->setText("Footer Text");
$footer->setHtml("<html><body>Footer Text</body></html>");
$mail_settings->setFooter($footer);
$spam_check = new SpamCheck();
$spam_check->setEnable(true);
$spam_check->setThreshold(1);
$spam_check->setPostToUrl("https://spamcatcher.sendgrid.com");
$mail_settings->setSpamCheck($spam_check);
$mail->setMailSettings($mail_settings);
$tracking_settings = new TrackingSettings();
$click_tracking = new ClickTracking();
$click_tracking->setEnable(true);
$click_tracking->setEnableText(true);
$tracking_settings->setClickTracking($click_tracking);
$open_tracking = new OpenTracking();
$open_tracking->setEnable(true);
$open_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message");
$tracking_settings->setOpenTracking($open_tracking);
$subscription_tracking = new SubscriptionTracking();
$subscription_tracking->setEnable(true);
$subscription_tracking->setText("text to insert into the text/plain portion of the message");
$subscription_tracking->setHtml("<html><body>html to insert into the text/html portion of the message</body></html>");
$subscription_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message");
$tracking_settings->setSubscriptionTracking($subscription_tracking);
$ganalytics = new Ganalytics();
$ganalytics->setEnable(true);
$ganalytics->setCampaignSource("some source");
$ganalytics->setCampaignTerm("some term");
$ganalytics->setCampaignContent("some content");
$ganalytics->setCampaignName("some name");
$ganalytics->setCampaignMedium("some medium");
$tracking_settings->setGanalytics($ganalytics);
$mail->setTrackingSettings($tracking_settings);
$reply_to = new ReplyTo("test@example.com");
$mail->setReplyTo($reply_to);
//echo json_encode($mail, JSON_PRETTY_PRINT), "\n";
return $mail;
}
示例8: forgot
public function forgot()
{
// Redirect if user is already logged
if ($this->auth->isLogged()) {
$this->response->redirect($this->url->link('account/account', '', 'SSL'));
}
$this->document->setTitle(tt('Request a password reset'));
$data = array();
if ('POST' == $this->request->getRequestMethod() && $this->_validateForgot()) {
// Reset password
$password = substr(sha1(uniqid(mt_rand(), true)), 0, 10);
$this->model_account_user->resetPassword($this->request->post['email'], $password);
$mail = new Mail();
$mail->setTo($this->request->post['email']);
$mail->setFrom(MAIL_FROM);
$mail->setReplyTo(MAIL_INFO);
$mail->setSender(MAIL_SENDER);
$mail->setSubject(tt('BitsyBay - Password recovery'));
$mail->setText(sprintf(tt("A new password was requested from %s\n"), $this->request->post['email']) . sprintf(tt("Your new password is: %s"), $password));
$mail->send();
$this->session->setUserMessage(array('success' => tt('Recovery instructions sent to your email address!')));
// Redirect to login page
$this->response->redirect($this->url->link('account/account/login', isset($this->request->get['redirect']) ? 'redirect=' . $this->request->get['redirect'] : false, 'SSL'));
}
$data['error'] = $this->_error;
$data['action'] = $this->url->link('account/account/forgot', isset($this->request->get['redirect']) ? 'redirect=' . $this->request->get['redirect'] : false, 'SSL');
$data['href_account_account_create'] = $this->url->link('account/account/create', '', 'SSL');
$data['href_account_account_login'] = $this->url->link('account/account/login', '', 'SSL');
$data['href_common_information_faq'] = $this->url->link('common/information/faq');
$data['href_common_contact'] = $this->url->link('common/contact');
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
$data['email'] = isset($this->request->post['email']) ? $this->request->post['email'] : false;
$data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('Account'), 'href' => $this->url->link('account/account', '', 'SSL'), 'active' => false), array('name' => tt('Forgot'), 'href' => $this->url->link('account/account/forgot', '', 'SSL'), 'active' => true)));
// Renter the template
$this->response->setOutput($this->load->view('account/account/forgot.tpl', $data));
}
示例9: testKitchenSinkExample
//.........这里部分代码省略.........
$personalization2->addCc($email);
$email = new Email("Example User", "test@example.com");
$personalization2->addCc($email);
$email = new Email("Example User", "test@example.com");
$personalization2->addBcc($email);
$email = new Email("Example User", "test@example.com");
$personalization2->addBcc($email);
$personalization2->setSubject("Hello World from the SendGrid PHP Library");
$personalization2->addHeader("X-Test", "test");
$personalization2->addHeader("X-Mock", "true");
$personalization2->addSubstitution("%name%", "Example User");
$personalization2->addSubstitution("%city%", "Denver");
$personalization2->addCustomArg("user_id", "343");
$personalization2->addCustomArg("type", "marketing");
$personalization2->setSendAt(1443636843);
$mail->addPersonalization($personalization2);
$content = new Content("text/plain", "some text here");
$mail->addContent($content);
$content = new Content("text/html", "<html><body>some text here</body></html>");
$mail->addContent($content);
$attachment = new Attachment();
$attachment->setContent("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12");
$attachment->setType("application/pdf");
$attachment->setFilename("balance_001.pdf");
$attachment->setDisposition("attachment");
$attachment->setContentId("Balance Sheet");
$mail->addAttachment($attachment);
$attachment2 = new Attachment();
$attachment2->setContent("BwdW");
$attachment2->setType("image/png");
$attachment2->setFilename("banner.png");
$attachment2->setDisposition("inline");
$attachment2->setContentId("Banner");
$mail->addAttachment($attachment2);
$mail->setTemplateId("439b6d66-4408-4ead-83de-5c83c2ee313a");
$mail->addSection("%section1%", "Substitution Text for Section 1");
$mail->addSection("%section2%", "Substitution Text for Section 2");
$mail->addHeader("X-Test1", "1");
$mail->addHeader("X-Test2", "2");
$mail->addCategory("May");
$mail->addCategory("2016");
$mail->addCustomArg("campaign", "welcome");
$mail->addCustomArg("weekday", "morning");
$mail->setSendAt(1443636842);
$asm = new ASM();
$asm->setGroupId(99);
$asm->setGroupsToDisplay([4, 5, 6, 7, 8]);
$mail->setASM($asm);
$mail->setIpPoolName("23");
$mail_settings = new MailSettings();
$bcc_settings = new BccSettings();
$bcc_settings->setEnable(True);
$bcc_settings->setEmail("test@example.com");
$mail_settings->setBccSettings($bcc_settings);
$sandbox_mode = new SandBoxMode();
$sandbox_mode->setEnable(True);
$mail_settings->setSandboxMode($sandbox_mode);
$bypass_list_management = new BypassListManagement();
$bypass_list_management->setEnable(True);
$mail_settings->setBypassListManagement($bypass_list_management);
$footer = new Footer();
$footer->setEnable(true);
$footer->setText("Footer Text");
$footer->setHtml("<html><body>Footer Text</body></html>");
$mail_settings->setFooter($footer);
$spam_check = new SpamCheck();
$spam_check->setEnable(True);
$spam_check->setThreshold(1);
$spam_check->setPostToUrl("https://spamcatcher.sendgrid.com");
$mail_settings->setSpamCheck($spam_check);
$mail->setMailSettings($mail_settings);
$tracking_settings = new TrackingSettings();
$click_tracking = new ClickTracking();
$click_tracking->setEnable(true);
$click_tracking->setEnableText(True);
$tracking_settings->setClickTracking($click_tracking);
$open_tracking = new OpenTracking();
$open_tracking->setEnable(True);
$open_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message");
$tracking_settings->setOpenTracking($open_tracking);
$subscription_tracking = new SubscriptionTracking();
$subscription_tracking->setEnable(True);
$subscription_tracking->setText("text to insert into the text/plain portion of the message");
$subscription_tracking->setHtml("<html><body>html to insert into the text/html portion of the message</body></html>");
$subscription_tracking->setSubstitutionTag("Optional tag to replace with the open image in the body of the message");
$tracking_settings->setSubscriptionTracking($subscription_tracking);
$ganalytics = new Ganalytics();
$ganalytics->setEnable(True);
$ganalytics->setCampaignSource("some source");
$ganalytics->setCampaignTerm("some term");
$ganalytics->setCampaignContent("some content");
$ganalytics->setCampaignName("some name");
$ganalytics->setCampaignMedium("some medium");
$tracking_settings->setGanalytics($ganalytics);
$mail->setTrackingSettings($tracking_settings);
$reply_to = new ReplyTo("test@example.com");
$mail->setReplyTo($reply_to);
$json = json_encode($mail);
$this->assertEquals($json, '{"from":{"name":"DX","email":"test@example.com"},"personalizations":[{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843},{"to":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"cc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"bcc":[{"name":"Example User","email":"test@example.com"},{"name":"Example User","email":"test@example.com"}],"subject":"Hello World from the SendGrid PHP Library","headers":{"X-Test":"test","X-Mock":"true"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"user_id":"343","type":"marketing"},"send_at":1443636843}],"subject":"Hello World from the SendGrid PHP Library","content":[{"type":"text\\/plain","value":"some text here"},{"type":"text\\/html","value":"<html><body>some text here<\\/body><\\/html>"}],"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","type":"application\\/pdf","filename":"balance_001.pdf","disposition":"attachment","content_id":"Balance Sheet"},{"content":"BwdW","type":"image\\/png","filename":"banner.png","disposition":"inline","content_id":"Banner"}],"template_id":"439b6d66-4408-4ead-83de-5c83c2ee313a","sections":{"%section1%":"Substitution Text for Section 1","%section2%":"Substitution Text for Section 2"},"headers":{"X-Test1":"1","X-Test2":"2"},"categories":["May","2016"],"custom_args":{"campaign":"welcome","weekday":"morning"},"send_at":1443636842,"asm":{"group_id":99,"groups_to_display":[4,5,6,7,8]},"ip_pool_name":"23","mail_settings":{"bcc":{"enable":true,"email":"test@example.com"},"bypass_list_management":{"enable":true},"footer":{"enable":true,"text":"Footer Text","html":"<html><body>Footer Text<\\/body><\\/html>"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"threshold":1,"post_to_url":"https:\\/\\/spamcatcher.sendgrid.com"}},"tracking_settings":{"click_tracking":{"enable":true,"enable_text":true},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"text":"text to insert into the text\\/plain portion of the message","html":"<html><body>html to insert into the text\\/html portion of the message<\\/body><\\/html>","substitution_tag":"Optional tag to replace with the open image in the body of the message"},"ganalytics":{"enable":true,"utm_source":"some source","utm_medium":"some medium","utm_term":"some term","utm_content":"some content","utm_campaign":"some name"}},"reply_to":{"email":"test@example.com"}}');
}
示例10: index
public function index()
{
$this->load->language('information/contact');
$this->document->setTitle($this->language->get('heading_title'));
if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
$mail->setReplyTo($this->request->post['email']);
$mail->setSender(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
$mail->setText($this->request->post['enquiry']);
$mail->send();
$this->response->redirect($this->url->link('information/contact/success'));
}
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'));
$data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('information/contact'));
$data['heading_title'] = $this->language->get('heading_title');
$data['text_location'] = $this->language->get('text_location');
$data['text_store'] = $this->language->get('text_store');
$data['text_contact'] = $this->language->get('text_contact');
$data['text_address'] = $this->language->get('text_address');
$data['text_telephone'] = $this->language->get('text_telephone');
$data['text_fax'] = $this->language->get('text_fax');
$data['text_open'] = $this->language->get('text_open');
$data['text_comment'] = $this->language->get('text_comment');
$data['entry_name'] = $this->language->get('entry_name');
$data['entry_email'] = $this->language->get('entry_email');
$data['entry_enquiry'] = $this->language->get('entry_enquiry');
$data['button_map'] = $this->language->get('button_map');
if (isset($this->error['name'])) {
$data['error_name'] = $this->error['name'];
} else {
$data['error_name'] = '';
}
if (isset($this->error['email'])) {
$data['error_email'] = $this->error['email'];
} else {
$data['error_email'] = '';
}
if (isset($this->error['enquiry'])) {
$data['error_enquiry'] = $this->error['enquiry'];
} else {
$data['error_enquiry'] = '';
}
$data['button_submit'] = $this->language->get('button_submit');
$data['action'] = $this->url->link('information/contact', '', true);
$this->load->model('tool/image');
if ($this->config->get('config_image')) {
$data['image'] = $this->model_tool_image->resize($this->config->get('config_image'), $this->config->get($this->config->get('config_theme') . '_image_location_width'), $this->config->get($this->config->get('config_theme') . '_image_location_height'));
} else {
$data['image'] = false;
}
$data['store'] = $this->config->get('config_name');
$data['address'] = nl2br($this->config->get('config_address'));
$data['geocode'] = $this->config->get('config_geocode');
$data['geocode_hl'] = $this->config->get('config_language');
$data['telephone'] = $this->config->get('config_telephone');
$data['fax'] = $this->config->get('config_fax');
$data['open'] = nl2br($this->config->get('config_open'));
$data['comment'] = $this->config->get('config_comment');
$data['locations'] = array();
$this->load->model('localisation/location');
foreach ((array) $this->config->get('config_location') as $location_id) {
$location_info = $this->model_localisation_location->getLocation($location_id);
if ($location_info) {
if ($location_info['image']) {
$image = $this->model_tool_image->resize($location_info['image'], $this->config->get($this->config->get('config_theme') . '_image_location_width'), $this->config->get($this->config->get('config_theme') . '_image_location_height'));
} else {
$image = false;
}
$data['locations'][] = array('location_id' => $location_info['location_id'], 'name' => $location_info['name'], 'address' => nl2br($location_info['address']), 'geocode' => $location_info['geocode'], 'telephone' => $location_info['telephone'], 'fax' => $location_info['fax'], 'image' => $image, 'open' => nl2br($location_info['open']), 'comment' => $location_info['comment']);
}
}
if (isset($this->request->post['name'])) {
$data['name'] = $this->request->post['name'];
} else {
$data['name'] = $this->customer->getFirstName();
}
if (isset($this->request->post['email'])) {
$data['email'] = $this->request->post['email'];
} else {
$data['email'] = $this->customer->getEmail();
}
if (isset($this->request->post['enquiry'])) {
$data['enquiry'] = $this->request->post['enquiry'];
} else {
$data['enquiry'] = '';
}
// Captcha
if ($this->config->get($this->config->get('config_captcha') . '_status') && in_array('contact', (array) $this->config->get('config_captcha_page'))) {
$data['captcha'] = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha'), $this->error);
//.........这里部分代码省略.........
示例11: Language
// Language
$language = new Language($registry, $request, DEFAULT_LANGUAGE_ID);
$registry->set('language', $language);
// Currency
$currency = new Currency($registry, DEFAULT_CURRENCY_ID);
$registry->set('currency', $currency);
// Currency
$ffmpeg = new FFmpeg(FFMPEG_PATH);
$registry->set('ffmpeg', $ffmpeg);
// Cache
$cache = new Cache($registry);
$registry->set('cache', $cache);
// Email
$mail = new Mail();
$mail->setFrom(MAIL_EMAIL_SENDER_ADDRESS);
$mail->setReplyTo(MAIL_EMAIL_SENDER_ADDRESS);
$mail->setSender(MAIL_EMAIL_SENDER_NAME);
$registry->set('mail', $mail);
// Storage
$storage = new Storage($registry);
$registry->set('storage', $storage);
// Document
$registry->set('document', new Document());
// Auth
$auth = new Auth($registry);
$registry->set('auth', $auth);
// Security log
$security_log = new Log('security.txt', $auth->getId(), $request->getRemoteAddress());
$registry->set('security_log', $security_log);
// Tracking Code
if (isset($request->get['ref'])) {
示例12: addOrderHistory
//.........这里部分代码省略.........
$text = $language->get('text_new_received') . "\n\n";
$text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n";
$text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n";
$text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n";
$text .= $language->get('text_new_products') . "\n";
foreach ($order_product_query->rows as $product) {
$text .= $product['quantity'] . 'x ' . $product['name'] . ' (' . $product['model'] . ') ' . html_entity_decode($this->currency->format($product['total'] + ($this->config->get('config_tax') ? $product['tax'] * $product['quantity'] : 0), $order_info['currency_code'], $order_info['currency_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 = '" . $product['order_product_id'] . "'");
foreach ($order_option_query->rows as $option) {
if ($option['type'] != 'file') {
$value = $option['value'];
} else {
$value = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.'));
}
$text .= chr(9) . '-' . $option['name'] . ' ' . (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) . "\n";
}
}
foreach ($order_voucher_query->rows as $voucher) {
$text .= '1x ' . $voucher['description'] . ' ' . $this->currency->format($voucher['amount']);
}
$text .= "\n";
$text .= $language->get('text_new_order_total') . "\n";
foreach ($order_total_query->rows as $total) {
$text .= $total['title'] . ': ' . html_entity_decode($this->currency->format($total['value']), ENT_NOQUOTES, 'UTF-8') . "\n";
}
$text .= "\n";
if ($order_info['comment']) {
$text .= $language->get('text_new_comment') . "\n\n";
$text .= $order_info['comment'] . "\n\n";
}
$mail = new Mail($this->config->get('config_mail'));
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
$mail->setReplyTo($order_info['email']);
$mail->setSender($order_info['store_name']);
$mail->setSubject($subject);
$mail->setHtml($html);
$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
$mail->send();
// Send to additional alert emails
$emails = explode(',', $this->config->get('config_mail_alert'));
foreach ($emails as $email) {
if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
$mail->setTo($email);
$mail->send();
}
}
}
}
// If order status is not 0 then send update text email
if ($order_info['order_status_id'] && $order_status_id && $notify) {
$language = new Language($order_info['language_directory']);
$language->load('default');
$language->load('mail/order');
$data['url_store'] = $this->config->get('config_url');
$data['logo_store'] = $data['url_store'] . 'image/' . $this->config->get('config_logo');
$data['name_store'] = $this->config->get('config_name');
$data['subject'] = sprintf($language->get('text_update_subject'), html_entity_decode($data['name_store'], ENT_QUOTES, 'UTF-8'), $order_id);
$data['text_update_order'] = $language->get('text_update_order') . ' <b>' . $order_id . "</b><br/>";
$data['text_update_date_added'] = $language->get('text_update_date_added') . ' <b>' . date($language->get('datetime_format'), strtotime($order_info['date_added'])) . "</b>";
$order_status_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int) $order_status_id . "' AND language_id = '" . (int) $order_info['language_id'] . "'");
$data['order_status'] = $order_status_query->num_rows;
$data['text_update_order_status'] = $language->get('text_update_order_status');
$data['order_name'] = $order_status_query->row['name'];
$data['text_code'] = "Segue abaixo o link para rastreio de sua encomenda:";
$data['order_status_id'] = $order_status_id;
示例13: sprintf
$text .= sprintf("\tBuyer #%s\n", $approved_order['buyer_id']);
$text .= sprintf("\tSeller #%s\n", $approved_order['seller_id']);
$text .= sprintf("\tProduct #%s\n", $approved_order['product_id']);
$text .= sprintf("\tAmount: %s / Currency #%s\n", $approved_order['amount'], $approved_order['currency_id']);
$text .= sprintf("\tWithdraw address: %s\n", $approved_order['withdraw_address']);
$text .= sprintf("\tApproved time: %s\n\n", $approved_order['date']);
}
}
// Withdraw to the Bank Storage if Current Balance more than 0
$total_balance = $bitcoin->getbalance();
if (BITCOIN_STORAGE_WITHDRAW_ENABLED && 0 < $total_balance && $total_balance > BITCOIN_STORAGE_WITHDRAW_MINIMUM_AMOUNT) {
if ($bitcoin->sendtoaddress(BITCOIN_STORAGE_WITHDRAW_ADDRESS, $total_balance, 'BITSYBAY BACKUP')) {
$text .= "\n\nFund " . $total_balance . ' BTC has been send to the reserve address ' . BITCOIN_STORAGE_WITHDRAW_ADDRESS . ' at ' . date('d.m.y H:i:s');
} else {
$text .= "\n\nFund " . $total_balance . ' BTC has not been send to the reserve address ' . BITCOIN_STORAGE_WITHDRAW_ADDRESS . ' at ' . date('d.m.y H:i:s');
$text .= sprintf("\nReason: %s", $bitcoin->error);
}
}
// Send billing report
if (!empty($text)) {
$mail = new Mail();
$mail->setTo(MAIL_BILLING);
$mail->setFrom(MAIL_FROM);
$mail->setReplyTo(MAIL_INFO);
$mail->setSender(MAIL_SENDER);
$mail->setSubject('BitsyBay - ORDER PROCESSOR REPORT');
$mail->setText($text);
$mail->send();
}
// Output response
die('Done.');
示例14: report
public function report()
{
// Check request
if (!$this->request->isAjax()) {
$this->security_log->write('Try to send report without ajax request');
exit;
}
// Set variables
$product_id = (int) isset($this->request->post['product_id']) ? $this->request->post['product_id'] : 0;
$message = (int) isset($this->request->post['message']) ? $this->request->post['message'] : false;
if ($this->model_catalog_product->createReport($product_id, $message, $this->auth->getId())) {
$json = array('status' => 200, 'title' => tt('Report successfully sent!'), 'message' => tt('Your message will be reviewed in the near time.'));
$mail = new Mail();
$mail->setTo(MAIL_INFO);
$mail->setFrom(MAIL_FROM);
$mail->setReplyTo(MAIL_FROM);
$mail->setSender(MAIL_SENDER);
$mail->setSubject(tt('Report for product_id #' . $product_id));
$mail->setText($this->request->post['message']);
$mail->send();
} else {
$json = array('status' => 500, 'title' => tt('Connection error'), 'message' => tt('Please, try again later'));
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}