本文整理汇总了PHP中Mail::l方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::l方法的具体用法?PHP Mail::l怎么用?PHP Mail::l使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::l方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendConfirmationMail
/**
* sendConfirmationMail (This source code come from AuthControllerCore)
* @param Customer $customer
* @return bool
*/
public static function sendConfirmationMail($social_customer, $passwd)
{
if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL') || !Configuration::get('FSL_CUSTOMER_CREATION_EMAIL')) {
return true;
}
return Mail::Send(Context::getContext()->language->id, 'social_account', Mail::l('Welcome!'), array('{provider}' => $social_customer->getProvider(), '{username}' => $social_customer->username, '{firstname}' => $social_customer->firstname, '{lastname}' => $social_customer->lastname, '{email}' => $social_customer->email, '{passwd}' => $passwd), $social_customer->email, $social_customer->firstname . ' ' . $social_customer->lastname, null, null, null, null, dirname(__FILE__) . '/../mails/');
}
示例2: newMessage
private function newMessage($type, $phone, $cname, $message, $email_theme, $email_param = "")
{
$host = Tools::getHttpHost();
$phone = "+" . preg_replace('#\\D+#', '', $phone);
// insert to DB
$query = "insert into " . _DB_PREFIX_ . egmarketing::INSTALL_SQL_BD1NAME . " \r\n\t\t(`id_shop`, `host`, `type`, `phone`, `fname`, `lname`, `message`) \r\n\t\tvalues ('" . (int) $context->shop->id . "', '" . Tools::getHttpHost() . "', '" . $type . "', '" . $phone . "',\r\n\t\t\t'" . $cname . "', '" . $cname . "', '" . $message . "')";
Db::getInstance()->execute(trim($query));
// notify by email
if ($email_param == "") {
$email_param = Configuration::get('EGCALLME_EMAIL_NOTIFY');
}
if (trim($email_param) != "") {
$context = Context::getContext();
$param = array('{phone}' => $phone, '{message}' => $message, '{fname}' => $cname, '{shop_url}' => $host);
$emails = explode(';', $email_param);
foreach ($emails as $email) {
Mail::Send((int) $context->language->id, $email_theme, Mail::l($type, " " . $phone . " " . $host), $param, $email, $cname, null, null, null, null, _PS_MAIL_DIR_, false, (int) $context->shop->id);
}
}
// sms notification
$sms_message = "%type %host %phone %cname %message";
$sms_message = Meta::sprintf2($sms_message, array('host' => $host, 'type' => $type, 'phone' => $phone, 'cname' => $cname, 'message' => $message));
//$this->sendSMS($sms_message,"79601652555",2);
$param = array('{phone}' => str_replace('+', '', $phone), '{message}' => $message, '{fname}' => $cname, '{type}' => 'FastOrder', '{host}' => $host, '{shost}' => str_replace('.', '-', $host));
$this->sendTelegramm($param, $sms_message);
}
示例3: newMessage
private function newMessage($phone, $fname, $lname, $message, $context)
{
$host = Tools::getHttpHost();
// insert to DB
$query = "insert into " . _DB_PREFIX_ . egcallme::INSTALL_SQL_BD1NAME . " \n (`id_shop`, `host`, `type`, `phone`, `fname`,`lname`, `message`) \n values ('" . (int) $context->shop->id . "', '" . $host . "', 'callback', '" . $phone . "',\n '" . $fname . "','" . $lname . "', '" . $message . "')";
Db::getInstance()->execute(trim($query));
// notify by email
$emails_param = Configuration::get('EGCALLME_EMAIL_NOTIFY');
if (trim($emails_param) != "") {
$param = array('{phone}' => $phone, '{message}' => $message, '{fname}' => $fname, '{lname}' => $lname, '{host}' => $host);
$emails = explode(';', $emails_param);
$dir = egcallme::getModuleDir() . '/mails/';
foreach ($emails as $email) {
$email_theme = "email_notify";
Mail::Send((int) $context->language->id, $email_theme, Mail::l("NEW Callback " . $phone, $this->context->language->id), $param, trim($email), "", null, null, null, null, $dir, false, (int) $context->shop->id);
}
$param['{phone}'] = preg_replace('#\\D+#', '', $param['{phone}']);
$requests = Configuration::getMultiple(array('EGCALLME_HTTPNOT_1', 'EGCALLME_HTTPNOT_2', 'EGCALLME_HTTPNOT_3'));
$texts = Configuration::getMultiple(array('EGCALLME_HTTPNOT_1_TXT', 'EGCALLME_HTTPNOT_2_TXT', 'EGCALLME_HTTPNOT_3_TXT'));
foreach ($requests as $key => $request) {
$request = $this->replaceKeywords($param, $request, $texts[$key . '_TXT']);
$result = file_get_contents($request);
}
}
}
示例4: sendByMail
public static function sendByMail($log)
{
/* Send e-mail to the shop owner only if the minimal severity level has been reached */
if (intval(Configuration::get('PS_LOGS_BY_EMAIL')) <= intval($log->severity)) {
Mail::Send((int) Configuration::get('PS_LANG_DEFAULT'), 'log_alert', Mail::l('Log: You have a new alert from your shop'), array(), Configuration::get('PS_SHOP_EMAIL'));
}
}
示例5: postProcess
/**
* Start forms process
* @see FrontController::postProcess()
*/
public function postProcess()
{
if (Tools::isSubmit('email')) {
if (!($email = Tools::getValue('email')) || !Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('Invalid e-mail address');
} else {
$customer = new Customer();
$customer->getByemail($email);
if (!Validate::isLoadedObject($customer)) {
$this->errors[] = Tools::displayError('There is no account registered to this e-mail address.');
} elseif (!$customer->active) {
$this->errors[] = Tools::displayError('You cannot regenerate the password for this account.');
} elseif (strtotime($customer->last_passwd_gen . '+' . (int) ($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')) . ' minutes') - time() > 0) {
$this->errors[] = sprintf(Tools::displayError('You can regenerate your password only every %d minute(s)'), (int) $min_time);
} else {
$mail_params = array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{url}' => $this->context->link->getPageLink('password', true, null, 'token=' . $customer->secure_key . '&id_customer=' . (int) $customer->id));
if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
$this->context->smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
} else {
$this->errors[] = Tools::displayError('Error occurred while sending the e-mail.');
}
}
}
} elseif (($token = Tools::getValue('token')) && ($id_customer = (int) Tools::getValue('id_customer'))) {
$email = Db::getInstance()->getValue('SELECT `email` FROM ' . _DB_PREFIX_ . 'customer c WHERE c.`secure_key` = \'' . pSQL($token) . '\' AND c.id_customer = ' . (int) $id_customer);
if ($email) {
$customer = new Customer();
$customer->getByemail($email);
if (!Validate::isLoadedObject($customer)) {
$this->errors[] = Tools::displayError('Customer account not found');
} elseif (!$customer->active) {
$this->errors[] = Tools::displayError('You cannot regenerate the password for this account.');
} elseif (strtotime($customer->last_passwd_gen . '+' . (int) Configuration::get('PS_PASSWD_TIME_FRONT') . ' minutes') - time() > 0) {
Tools::redirect('index.php?controller=authentication&error_regen_pwd');
} else {
$customer->passwd = Tools::encrypt($password = Tools::passwdGen(MIN_PASSWD_LENGTH));
$customer->last_passwd_gen = date('Y-m-d H:i:s', time());
if ($customer->update()) {
Hook::exec('actionPasswordRenew', array('customer' => $customer, 'password' => $password));
$mail_params = array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{passwd}' => $password);
if (Mail::Send($this->context->language->id, 'password', Mail::l('Your new password'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
$this->context->smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
} else {
$this->errors[] = Tools::displayError('Error occurred while sending the e-mail.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred with your account and your new password cannot be sent to your e-mail. Please report your problem using the contact form.');
}
}
} else {
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
}
} elseif (Tools::getValue('token') || Tools::getValue('id_customer')) {
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
}
}
示例6: assign
/**
* Assign wishlist template
*/
public function assign()
{
$errors = array();
if ($this->context->customer->isLogged()) {
$add = Tools::getIsset('add');
$add = empty($add) === false ? 1 : 0;
$delete = Tools::getIsset('deleted');
$delete = empty($delete) === false ? 1 : 0;
$id_wishlist = Tools::getValue('id_wishlist');
if (Tools::isSubmit('submitWishlist')) {
if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 and strcmp(Tools::getToken(), Tools::getValue('token'))) {
$errors[] = $this->module->l('Invalid token', 'mywishlist');
}
if (!sizeof($errors)) {
$name = Tools::getValue('name');
if (empty($name)) {
$errors[] = $this->module->l('You must specify a name.', 'mywishlist');
}
if (WishList::isExistsByNameForUser($name)) {
$errors[] = $this->module->l('This name is already used by another list.', 'mywishlist');
}
if (!sizeof($errors)) {
$wishlist = new WishList();
$wishlist->id_shop = $this->context->shop->id;
$wishlist->id_shop_group = $this->context->shop->id_shop_group;
$wishlist->name = $name;
$wishlist->id_customer = (int) $this->context->customer->id;
list($us, $s) = explode(' ', microtime());
srand($s * $us);
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true) . _COOKIE_KEY_ . $this->context->customer->id), 0, 16));
$wishlist->add();
Mail::Send($this->context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $this->context->language->id), array('{wishlist}' => $wishlist->name, '{message}' => Tools::getProtocol() . htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/blockwishlist/view.php?token=' . $wishlist->token), $this->context->customer->email, $this->context->customer->firstname . ' ' . $this->context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, $this->module->getLocalPath() . 'mails/');
}
}
} else {
if ($add) {
WishList::addCardToWishlist($this->context->customer->id, Tools::getValue('id_wishlist'), $this->context->language->id);
} else {
if ($delete and empty($id_wishlist) === false) {
$wishlist = new WishList((int) $id_wishlist);
if (Validate::isLoadedObject($wishlist)) {
$wishlist->delete();
} else {
$errors[] = $this->module->l('Cannot delete this wishlist', 'mywishlist');
}
}
}
}
$this->context->smarty->assign('wishlists', WishList::getByIdCustomer($this->context->customer->id));
$this->context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($this->context->customer->id));
} else {
Tools::redirect('index.php?controller=authentication&back=' . urlencode($this->context->link->getModuleLink('blockwishlist', 'mywishlist')));
}
$this->context->smarty->assign(array('id_customer' => (int) $this->context->customer->id, 'errors' => $errors, 'form_link' => $errors));
$this->setTemplate('mywishlist.tpl');
}
示例7: SendTranslateSubject
public static function SendTranslateSubject($id_lang, $template, $templateVars, $to, $toName = NULL, $from = NULL, $fromName = NULL, $fileAttachment = NULL, $modeSMTP = NULL, $templatePath = _PS_MAIL_DIR_, $die = false, $id_shop = NULL, $bcc = null)
{
${"GLOBALS"}["ofwtthdu"] = "templatePath";
${"GLOBALS"}["waqsvhsc"] = "from";
${"GLOBALS"}["oljyfstsifb"] = "fileAttachment";
${"GLOBALS"}["ktavbwwuty"] = "die";
${"GLOBALS"}["pbykixc"] = "toName";
${"GLOBALS"}["ygkvnpurdj"] = "id_lang";
${"GLOBALS"}["nrxherkluqq"] = "toName";
$pvdkehuv = "toName";
$uiwfgerto = "fromName";
${"GLOBALS"}["mwjoukbjfci"] = "templatePath";
${"GLOBALS"}["asvlqglenan"] = "die";
${"GLOBALS"}["gtukoxtrtzfi"] = "modeSMTP";
${"GLOBALS"}["kesvwedp"] = "to";
${"GLOBALS"}["kdgoyhmsahxr"] = "bcc";
$hfncmd = "id_lang";
$wyjnsgeimx = "templatePath";
${"GLOBALS"}["comjqjca"] = "templateVars";
$chllfgsuw = "from";
${"GLOBALS"}["ggypray"] = "id_shop";
$ungkmvucvl = "id_shop";
${"GLOBALS"}["nmxbjsqu"] = "id_shop";
$vjstsi = "fileAttachment";
${"GLOBALS"}["ohlqtao"] = "id_lang";
${"GLOBALS"}["viwpzapqypm"] = "from";
$uebssytghjjc = "fromName";
${"GLOBALS"}["ffrcidosklbi"] = "fromName";
${"GLOBALS"}["rcvwsfnutml"] = "id_shop";
${"GLOBALS"}["vuhnpgm"] = "id_lang";
${"GLOBALS"}["qtvkxqmputu"] = "to";
${"GLOBALS"}["tlsoaxi"] = "modeSMTP";
$orgwjctvwjf = "modeSMTP";
${"GLOBALS"}["drwyhg"] = "templateVars";
${"GLOBALS"}["jxxusew"] = "toName";
$spcvktgi = "die";
${"GLOBALS"}["ihiiypxhojun"] = "bcc";
$uvoidyuj = "templatePath";
$euugydhqjd = "templatePath";
$cimcxfmih = "to";
switch (${${"GLOBALS"}["obburiaad"]}) {
case "new_order":
return Mail::Send(${${"GLOBALS"}["vuhnpgm"]}, "new_order", Mail::l('New Order'), ${${"GLOBALS"}["opsyefhwbkot"]}, ${$cimcxfmih}, ${${"GLOBALS"}["pximfkjwj"]}, ${$chllfgsuw}, ${${"GLOBALS"}["ffrcidosklbi"]}, ${${"GLOBALS"}["leiyninz"]}, ${${"GLOBALS"}["gtukoxtrtzfi"]}, ${${"GLOBALS"}["ghlgsfyfdx"]}, ${${"GLOBALS"}["mryvscjv"]}, ${${"GLOBALS"}["rcvwsfnutml"]}, ${${"GLOBALS"}["llhlusocwbt"]});
case "fund_request":
return Mail::Send(${${"GLOBALS"}["ohlqtao"]}, "fund_request", Mail::l('Fund request from a seller'), ${${"GLOBALS"}["drwyhg"]}, ${${"GLOBALS"}["xjcxgnow"]}, ${${"GLOBALS"}["nrxherkluqq"]}, ${${"GLOBALS"}["ufhhkde"]}, ${${"GLOBALS"}["ebejdcjwvbis"]}, ${$vjstsi}, ${${"GLOBALS"}["yuvpsy"]}, ${${"GLOBALS"}["ofwtthdu"]}, ${${"GLOBALS"}["asvlqglenan"]}, ${${"GLOBALS"}["nmxbjsqu"]}, ${${"GLOBALS"}["llhlusocwbt"]});
case "app_selleraccount":
return Mail::Send(${$hfncmd}, "app_selleraccount", Mail::l('Your seller account approved!'), ${${"GLOBALS"}["comjqjca"]}, ${${"GLOBALS"}["xjcxgnow"]}, ${${"GLOBALS"}["pbykixc"]}, ${${"GLOBALS"}["viwpzapqypm"]}, ${${"GLOBALS"}["ebejdcjwvbis"]}, ${${"GLOBALS"}["oljyfstsifb"]}, ${${"GLOBALS"}["yuvpsy"]}, ${$euugydhqjd}, ${${"GLOBALS"}["ktavbwwuty"]}, ${${"GLOBALS"}["cfimirivyt"]}, ${${"GLOBALS"}["llhlusocwbt"]});
case "new_selleraccount":
return Mail::Send(${${"GLOBALS"}["edbldrigs"]}, "new_selleraccount", Mail::l('Your seller account'), ${${"GLOBALS"}["opsyefhwbkot"]}, ${${"GLOBALS"}["kesvwedp"]}, ${$pvdkehuv}, ${${"GLOBALS"}["ufhhkde"]}, ${$uebssytghjjc}, ${${"GLOBALS"}["leiyninz"]}, ${${"GLOBALS"}["tlsoaxi"]}, ${$uvoidyuj}, ${$spcvktgi}, ${$ungkmvucvl}, ${${"GLOBALS"}["ihiiypxhojun"]});
case "new_selleraccount_admin":
return Mail::Send(${${"GLOBALS"}["edbldrigs"]}, "new_selleraccount_admin", Mail::l('A new seller account has been added'), ${${"GLOBALS"}["opsyefhwbkot"]}, ${${"GLOBALS"}["xjcxgnow"]}, ${${"GLOBALS"}["jxxusew"]}, ${${"GLOBALS"}["ufhhkde"]}, ${${"GLOBALS"}["ebejdcjwvbis"]}, ${${"GLOBALS"}["leiyninz"]}, ${$orgwjctvwjf}, ${${"GLOBALS"}["mwjoukbjfci"]}, ${${"GLOBALS"}["mryvscjv"]}, ${${"GLOBALS"}["ggypray"]}, ${${"GLOBALS"}["llhlusocwbt"]});
case "new_product":
return Mail::Send(${${"GLOBALS"}["ygkvnpurdj"]}, "new_product", Mail::l('New product approval request'), ${${"GLOBALS"}["opsyefhwbkot"]}, ${${"GLOBALS"}["qtvkxqmputu"]}, ${${"GLOBALS"}["pximfkjwj"]}, ${${"GLOBALS"}["waqsvhsc"]}, ${$uiwfgerto}, ${${"GLOBALS"}["leiyninz"]}, ${${"GLOBALS"}["yuvpsy"]}, ${$wyjnsgeimx}, ${${"GLOBALS"}["mryvscjv"]}, ${${"GLOBALS"}["cfimirivyt"]}, ${${"GLOBALS"}["kdgoyhmsahxr"]});
}
}
示例8: sendConfirmationMail
protected function sendConfirmationMail(Customer $customer)
{
/*
* EU-Legal
* Password not visible
*/
if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL')) {
return true;
}
return Mail::Send($this->context->language->id, 'account', Mail::l('Welcome!'), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => '***'), $customer->email, $customer->firstname . ' ' . $customer->lastname);
}
示例9: sendCampaign
public function sendCampaign()
{
// get abandoned cart :
$sql = "SELECT * FROM (\n\t\tSELECT\n\t\tCONCAT(LEFT(c.`firstname`, 1), '. ', c.`lastname`) `customer`, a.id_cart total, ca.name carrier, c.id_customer, a.id_cart, a.date_upd,a.date_add,\n\t\t\t\tIF (IFNULL(o.id_order, 'Non ordered') = 'Non ordered', IF(TIME_TO_SEC(TIMEDIFF('" . date('Y-m-d H:i:s') . "', a.`date_add`)) > 86400, 'Abandoned cart', 'Non ordered'), o.id_order) id_order, IF(o.id_order, 1, 0) badge_success, IF(o.id_order, 0, 1) badge_danger, IF(co.id_guest, 1, 0) id_guest\n\t\tFROM `" . _DB_PREFIX_ . "cart` a \n\t\t\t\tJOIN `" . _DB_PREFIX_ . "customer` c ON (c.id_customer = a.id_customer)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "currency` cu ON (cu.id_currency = a.id_currency)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "carrier` ca ON (ca.id_carrier = a.id_carrier)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "orders` o ON (o.id_cart = a.id_cart)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "connections` co ON (a.id_guest = co.id_guest AND TIME_TO_SEC(TIMEDIFF('" . date('Y-m-d H:i:s') . "', co.`date_add`)) < 1800)\n\t\t) AS toto WHERE id_order='Abandoned cart'";
$currency = Context::getContext()->currency->sign;
$defaultLanguage = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
$abandoned_carts = Db::getInstance()->ExecuteS($sql);
// get all available campaigns
$sqlCampaigns = 'SELECT * FROM `' . _DB_PREFIX_ . 'campaign` WHERE active=1';
$allCampaigns = Db::getInstance()->ExecuteS($sqlCampaigns);
// loop on all abandoned carts
foreach ($abandoned_carts as $abncart) {
// loop on all available campaigns
foreach ($allCampaigns as $camp) {
$cartIsOnCampaign = $this->checkIfCartIsOnCampaign($abncart['date_add'], $camp['execution_time_day'], $camp['execution_time_hour']);
if ($cartIsOnCampaign) {
$id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
$customer = new Customer($abncart['id_customer']);
$cR = new CartRule($camp['id_voucher'], $id_lang);
$cart = new Cart($abncart['id_cart']);
$products = $cart->getProducts();
$campM = new Campaign($camp['id_campaign']);
if (!empty($products)) {
$cart_content = $campM->getCartContentHeader();
} else {
$cart_content = '';
}
foreach ($products as $prod) {
$p = new Product($prod['id_product'], true, $id_lang);
$price_no_tax = Product::getPriceStatic($p->id, false, null, 2, null, false, true, 1, false, null, $abncart['id_cart'], null, $null, true, true, null, false, false);
$total_no_tax = $prod['cart_quantity'] * $price_no_tax;
$images = Image::getImages((int) $id_lang, (int) $p->id);
$link = new Link();
$cart_content .= '<tr >
<td align="center" ><img src="' . $link->getImageLink($p->link_rewrite, $images[0]['id_image']) . '" width="80"/></td>
<td align="center" ><a href="' . $link->getProductLink($p) . '"/>' . $p->name . '</a></td>
<td align="center" >' . Tools::displayprice($price_no_tax) . '</td>
<td align="center" >' . $prod['cart_quantity'] . '</td>
<td align="center" >' . Tools::displayprice($total_no_tax) . '</td>
</tr>';
}
$tpl_vars = array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{coupon_name}' => $cR->name, '{coupon_code}' => $cR->code, '{cart_content}' => $cart_content, '{coupon_value}' => $camp['voucher_amount_type'] == 'percent' ? $cR->reduction_percent . '%' : $currency . $cR->reduction_amount, '{coupon_valid_to}' => date('d/m/Y', strtotime($cR->date_to)), '{campaign_name}' => $camp['name']);
$path = _PS_ROOT_DIR_ . '/modules/superabandonedcart/mails/';
// send email to customer :
Mail::Send($id_lang, $campM->getFileName(), $camp['name'], $tpl_vars, $customer->email, null, null, null, null, null, $path, false, Context::getContext()->shop->id);
// Email to admin :
Mail::Send($id_lang, $campM->getFileName(), Mail::l(sprintf('Email sent to %s %s for campaign %s', $customer->lastname, $customer->firstname, $camp['name'])), $tpl_vars, Configuration::get('PS_SHOP_EMAIL'), null, null, null, null, null, $path, false, Context::getContext()->shop->id);
// echo 'ID ' . $abncart['id_cart'];
}
}
}
}
示例10: postEmail
public function postEmail($data)
{
$validate = $this->validation($data);
if ($validate && empty($validate['error'])) {
$template_vars = array('{guest_name}' => $validate['name'], '{guest_phone}' => $validate['phone']);
$shop_email = strval(Configuration::get('PS_SHOP_EMAIL'));
if (Mail::Send($this->context->language->id, 'callme', Mail::l('Email Call Me', $this->context->language->id), $template_vars, $shop_email, null, null, null, null, null, dirname(__FILE__) . '/mails/', false, $this->context->shop->id)) {
return $this->viewStatus(true);
}
} else {
return $this->viewStatus(false);
}
}
示例11: hookActionObjectCustomerUpdateAfter
public function hookActionObjectCustomerUpdateAfter($params)
{
$data = parse_str($_SERVER['HTTP_REFERER']);
$customer_id = $id_customer;
$customer = new Customer($customer_id);
$customer_status_after = strval(Tools::getValue('active'));
if ($this->customer_status_before != $customer_status_after && $customer_status_after === '1') {
/*echo '<script type="text/javascript">';
echo 'console.log(Name:'.dirname(__FILE__).'/mails/)';
echo '</script>';*/
Mail::Send($this->context->language->id, 'account_activated', Mail::l('Your account has been activated.', $this->context->language->id), array('{email}' => $customer->email, '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{shopname}' => $this->context->shop->name), $customer->email, $customer->lastname, NULL, $this->context->shop->name, NULL, NULL, dirname(__FILE__) . '/mails/');
}
}
示例12: postProcess
public function postProcess()
{
global $currentIndex, $cookie;
if (Tools::isSubmit('deleteorder_return_detail')) {
if ($this->tabAccess['delete'] === '1') {
if ($id_order_detail = (int) Tools::getValue('id_order_detail') and Validate::isUnsignedId($id_order_detail)) {
if ($id_order_return = (int) Tools::getValue('id_order_return') and Validate::isUnsignedId($id_order_return)) {
$orderReturn = new OrderReturn($id_order_return);
if (!Validate::isLoadedObject($orderReturn)) {
die(Tools::displayError());
}
if ((int) $orderReturn->countProduct() > 1) {
if (OrderReturn::deleteOrderReturnDetail($id_order_return, $id_order_detail, (int) Tools::getValue('id_customization', 0))) {
Tools::redirectAdmin($currentIndex . '&conf=4token=' . $this->token);
} else {
$this->_errors[] = Tools::displayError('An error occurred while deleting an order return detail.');
}
} else {
$this->_errors[] = Tools::displayError('You need at least one product.');
}
} else {
$this->_errors[] = Tools::displayError('The order return is invalid.');
}
} else {
$this->_errors[] = Tools::displayError('The order return detail is invalid.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} elseif (Tools::isSubmit('submitAddorder_return')) {
if ($this->tabAccess['edit'] === '1') {
if ($id_order_return = (int) Tools::getValue('id_order_return') and Validate::isUnsignedId($id_order_return)) {
$orderReturn = new OrderReturn($id_order_return);
$order = new Order($orderReturn->id_order);
$customer = new Customer($orderReturn->id_customer);
$orderReturn->state = (int) Tools::getValue('state');
if ($orderReturn->save()) {
$orderReturnState = new OrderReturnState($orderReturn->state);
$vars = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order_return}' => $id_order_return, '{order_name}' => sprintf("#%06d", (int) $order->id), '{state_order_return}' => isset($orderReturnState->name[(int) $order->id_lang]) ? $orderReturnState->name[(int) $order->id_lang] : $orderReturnState->name[(int) _PS_LANG_DEFAULT_]);
Mail::Send((int) $order->id_lang, 'order_return_state', Mail::l('Your order return state has changed', (int) $order->id_lang), $vars, $customer->email, $customer->firstname . ' ' . $customer->lastname, NULL, NULL, NULL, NULL, _PS_MAIL_DIR_, true);
Tools::redirectAdmin($currentIndex . '&conf=4&token=' . $this->token);
}
} else {
$this->_errors[] = Tools::displayError('No order return ID.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
}
parent::postProcess();
}
示例13: onConversionExpired
private function onConversionExpired()
{
if (!Configuration::get('CASHWAY_SEND_EMAIL')) {
$this->terminateReply(202, 'Ok, but not sending email per shop config.');
}
$order = new Order((int) $this->data->order_id);
if (!Validate::isLoadedObject($order)) {
$this->terminateReply(404, 'Could not find such an order.');
}
$customer = new Customer($order->id_customer);
$reorder_url = $this->context->link->getPageLink('order', true, $this->context->language->id, array('submitReorder' => '1', 'id_order' => (int) $order->id));
Mail::Send($this->context->language->id, 'conversion_expired', Mail::l('', $this->context->language->id), array('{reorder_url}' => $reorder_url), $customer->email, null, null, null, null, null, dirname(__FILE__) . '/mails/', false, $this->context->shop->id);
$this->terminateReply(201, 'Call back email sent.');
}
示例14: process
public function process()
{
parent::process();
if (Tools::isSubmit('email')) {
if (!($email = Tools::getValue('email')) or !Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('Invalid e-mail address');
} else {
$customer = new Customer();
$customer->getByemail($email);
if (!Validate::isLoadedObject($customer)) {
$this->errors[] = Tools::displayError('There is no account registered to this e-mail address.');
} else {
if (strtotime($customer->last_passwd_gen . '+' . (int) ($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')) . ' minutes') - time() > 0) {
$this->errors[] = Tools::displayError('You can regenerate your password only every') . ' ' . (int) $min_time . ' ' . Tools::displayError('minute(s)');
} else {
if (Mail::Send((int) self::$cookie->id_lang, 'password_query', Mail::l('Password query confirmation'), array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{url}' => self::$link->getPageLink('password.php', true) . '?token=' . $customer->secure_key . '&id_customer=' . (int) $customer->id), $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
self::$smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
} else {
$this->errors[] = Tools::displayError('Error occurred when sending the e-mail.');
}
}
}
}
} elseif (($token = Tools::getValue('token')) && ($id_customer = (int) Tools::getValue('id_customer'))) {
$email = Db::getInstance()->getValue('SELECT `email` FROM ' . _DB_PREFIX_ . 'customer c WHERE c.`secure_key` = \'' . pSQL($token) . '\' AND c.id_customer = ' . (int) $id_customer);
if ($email) {
$customer = new Customer();
$customer->getByemail($email);
if (strtotime($customer->last_passwd_gen . '+' . (int) ($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')) . ' minutes') - time() > 0) {
Tools::redirect('authentication.php?error_regen_pwd');
} else {
$customer->passwd = Tools::encrypt($password = Tools::passwdGen((int) MIN_PASSWD_LENGTH));
$customer->last_passwd_gen = date('Y-m-d H:i:s', time());
if ($customer->update()) {
if (Mail::Send((int) self::$cookie->id_lang, 'password', Mail::l('Your password'), array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{passwd}' => $password), $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
self::$smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
} else {
$this->errors[] = Tools::displayError('Error occurred when sending the e-mail.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred with your account and your new password cannot be sent to your e-mail. Please report your problem using the contact form.');
}
}
} else {
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
}
} elseif (($token = Tools::getValue('token')) || ($id_customer = Tools::getValue('id_customer'))) {
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
}
}
示例15: displayFrontForm
public function displayFrontForm()
{
global $smarty;
$error = false;
$confirm = false;
if (isset($_POST['submitAddtoafriend'])) {
global $cookie, $link;
/* Product informations */
$product = new Product((int) Tools::getValue('id_product'), false, (int) $cookie->id_lang);
$productLink = $link->getProductLink($product);
/* Fields verifications */
if (empty($_POST['email']) or empty($_POST['name'])) {
$error = $this->l('You must fill in all fields.');
} elseif (empty($_POST['email']) or !Validate::isEmail($_POST['email'])) {
$error = $this->l('The e-mail given is invalid.');
} elseif (!Validate::isName($_POST['name'])) {
$error = $this->l('The name given is invalid.');
} elseif (!isset($_GET['id_product']) or !is_numeric($_GET['id_product'])) {
$error = $this->l('An error occurred during the process.');
} else {
/* Email generation */
$subject = ($cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : $this->l('A friend')) . ' ' . $this->l('sent you a link to') . ' ' . $product->name;
$templateVars = array('{product}' => $product->name, '{product_link}' => $productLink, '{customer}' => $cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : $this->l('A friend'), '{name}' => Tools::safeOutput($_POST['name']));
/* Email sending */
if (!Mail::Send((int) $cookie->id_lang, 'send_to_a_friend', Mail::l('A friend sent you a link to') . ' ' . $product->name, $templateVars, $_POST['email'], NULL, $cookie->email ? $cookie->email : NULL, $cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : NULL, NULL, NULL, dirname(__FILE__) . '/mails/')) {
$error = $this->l('An error occurred during the process.');
} else {
Tools::redirect(_MODULE_DIR_ . '/' . $this->name . '/sendtoafriend-form.php?id_product=' . $product->id . '&submited');
}
}
} else {
global $cookie, $link;
/* Product informations */
$product = new Product((int) Tools::getValue('id_product'), false, (int) $cookie->id_lang);
$productLink = $link->getProductLink($product);
}
/* Image */
$images = $product->getImages((int) $cookie->id_lang);
foreach ($images as $k => $image) {
if ($image['cover']) {
$cover['id_image'] = (int) $product->id . '-' . (int) $image['id_image'];
$cover['legend'] = $image['legend'];
}
}
if (!isset($cover)) {
$cover = array('id_image' => Language::getIsoById((int) $cookie->id_lang) . '-default', 'legend' => 'No picture');
}
$smarty->assign(array('cover' => $cover, 'errors' => $error, 'confirm' => $confirm, 'product' => $product, 'productLink' => $productLink));
return $this->display(__FILE__, 'sendtoafriend.tpl');
}