[*] Core : added the possibility to disable the emails (i.e. for test purpose)
This commit is contained in:
+16
-12
@@ -54,18 +54,6 @@ class MailCore
|
|||||||
public static function Send($id_lang, $template, $subject, $template_vars, $to,
|
public static function Send($id_lang, $template, $subject, $template_vars, $to,
|
||||||
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null)
|
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null)
|
||||||
{
|
{
|
||||||
$theme_path = _PS_THEME_DIR_;
|
|
||||||
|
|
||||||
// Get the path of theme by id_shop if exist
|
|
||||||
if (is_numeric($id_shop) && $id_shop)
|
|
||||||
{
|
|
||||||
$shop = new Shop((int)$id_shop);
|
|
||||||
$theme_name = $shop->getTheme();
|
|
||||||
|
|
||||||
if (_THEME_NAME_ != $theme_name)
|
|
||||||
$theme_path = _PS_ROOT_DIR_.'/themes/'.$theme_name.'/';
|
|
||||||
}
|
|
||||||
|
|
||||||
$configuration = Configuration::getMultiple(array(
|
$configuration = Configuration::getMultiple(array(
|
||||||
'PS_SHOP_EMAIL',
|
'PS_SHOP_EMAIL',
|
||||||
'PS_MAIL_METHOD',
|
'PS_MAIL_METHOD',
|
||||||
@@ -78,6 +66,22 @@ class MailCore
|
|||||||
'PS_MAIL_METHOD',
|
'PS_MAIL_METHOD',
|
||||||
'PS_MAIL_TYPE'
|
'PS_MAIL_TYPE'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Returns immediatly if emails are deactivated
|
||||||
|
if ($configuration['PS_MAIL_METHOD'] == 3)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
$theme_path = _PS_THEME_DIR_;
|
||||||
|
|
||||||
|
// Get the path of theme by id_shop if exist
|
||||||
|
if (is_numeric($id_shop) && $id_shop)
|
||||||
|
{
|
||||||
|
$shop = new Shop((int)$id_shop);
|
||||||
|
$theme_name = $shop->getTheme();
|
||||||
|
|
||||||
|
if (_THEME_NAME_ != $theme_name)
|
||||||
|
$theme_path = _PS_ROOT_DIR_.'/themes/'.$theme_name.'/';
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION']))
|
if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION']))
|
||||||
$configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off';
|
$configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off';
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class AdminEmailsControllerCore extends AdminController
|
|||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'choices' => array(
|
'choices' => array(
|
||||||
|
3 => $this->l('Never send emails (may be useful for test purpose)'),
|
||||||
1 => $this->l('Use PHP mail() function. Recommended; works in most cases'),
|
1 => $this->l('Use PHP mail() function. Recommended; works in most cases'),
|
||||||
2 => $this->l('Set my own SMTP parameters. For advanced users ONLY')
|
2 => $this->l('Set my own SMTP parameters. For advanced users ONLY')
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user