Jump to content

How to send a Test E-Mail using the Test E-Mail Template?


Recommended Posts

Localization >> Translations >> Email templates translations (default-template) features a Test E-Mail Template (HTML & Plaintext).

Where in the back office can this test e-mail be sent?

It's not Advanced Parameters >> E-mail >> Test Your Email Configuration, which just sends a simple plaintext e-mail saying "This is a test message. Your server is now configured to send email.", and I could not find any other place in the back office which would allow sending a test e-mail.

What's missing here?

Link to comment
Share on other sites

I tried to find it in code, but couldn't. So I wrote scipt which sends it:

<?php

require_once(dirname(__FILE__).'/config/config.inc.php');
require_once(dirname(__FILE__).'/init.php');

$vars = array('{shop_name}' => 'test'); 

Mail::Send((int)Context::getContext()->language->id, 'test','test', array(), '[email protected]');

?>

create this file in root www directory and run it

  • Like 1
Link to comment
Share on other sites

I tried to find it in code, but couldn't. So I wrote scipt which sends it:

<?php

require_once(dirname(__FILE__).'/config/config.inc.php');
require_once(dirname(__FILE__).'/init.php');

$vars = array('{shop_name}' => 'test'); 

Mail::Send((int)Context::getContext()->language->id, 'test','test', array(), '[email protected]');

?>

create this file in root www directory and run it

 

Thanks, will try asap. How do I set the language ID with this?

Link to comment
Share on other sites

well change "(int)Context::getContext()->language->id" to any number you need

 

OK, and what exactly does "(int)Context::getContext()->language->id" do as is? I mean if I put that code into a file and call it directly from the web root it's not assigned with a language setting, is it?

Link to comment
Share on other sites

  • 1 year later...

It is very late, but it may be used for other...

 

To solve your problem (Prestashop 1.6), put into PS_BASE/override/controllers/admin/ this file :

 

AdminEmailsController.php

<?php
class AdminEmailsController extends AdminEmailsControllerCore
{
    public function ajaxProcessSendMailTest()
    {
        if (_PS_MODE_DEMO_)
            die(Tools::displayError('This functionality has been disabled.'));
        if ($this->tabAccess['view'] === '1') {
            $content = urldecode(Tools::getValue('testMsg'));
            $content = html_entity_decode($content);
            $subject = urldecode(Tools::getValue('testSubject'));
            $to = Tools::getValue('testEmail');
            $from = Configuration::get('PS_SHOP_EMAIL');
            $result = Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'test', Tools::htmlentitiesUTF8($subject),
                array(), array(Tools::htmlentitiesUTF8($to)), null, Tools::htmlentitiesUTF8($from), null, null, null,
                null, false, null, null, null);
            die(isset($result) ? 'ok' : 'Erreur d\'envoi...');
        }
    }
}
?>

This new function called your templates «test.txt» and «test.html» when sending test mail.

Edited by Agence web Cibles.fr (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...