diff --git a/classes/Mail.php b/classes/Mail.php index ea6a7134f..77ee422c5 100644 --- a/classes/Mail.php +++ b/classes/Mail.php @@ -54,18 +54,6 @@ class MailCore 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) { - $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( 'PS_SHOP_EMAIL', 'PS_MAIL_METHOD', @@ -78,6 +66,22 @@ class MailCore 'PS_MAIL_METHOD', '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'])) $configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off'; diff --git a/controllers/admin/AdminEmailsController.php b/controllers/admin/AdminEmailsController.php index 788a3d3aa..63a298d17 100644 --- a/controllers/admin/AdminEmailsController.php +++ b/controllers/admin/AdminEmailsController.php @@ -56,6 +56,7 @@ class AdminEmailsControllerCore extends AdminController 'type' => 'radio', 'required' => true, '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'), 2 => $this->l('Set my own SMTP parameters. For advanced users ONLY') ),