Jump to content

How to send test email on different mail template?


Darius1990

Recommended Posts

Hi everyone,

I want to modify email templates like "newsletter.html" or "shipped.html". But It would be pain to create change each time status of order that is shipped to get email. There is any simpler way? for example we have "send test email" maybe we can use it to send test email with different email templates. Thank you for any help

Link to comment
Share on other sites

SOLVED: add this to AdminEmailController.php + comment first line and you can easy send test emails with different email template .

P.S. Don't forget to update email in the code

 

            // $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), $smtpPassword, Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
            $mFiles = array(
                'account',
                'bankwire',
                'contact',
                'contact_form',
                'credit_slip',
                'forward_msg', 
                'guest_to_customer', 
                'in_transit',
                'newsletter', 
                'order_canceled',
                'order_changed', 
                'order_conf',
                'order_merchant_comment', 
                'order_return_state',
                'outofstock',
                'password',
                'password_query',
                'payment',
                'payment_error',
                'preparation',
                'refund',
                'reply_msg',
                'shipped',
                'voucher', 
                'voucher_new'
            );
            foreach ($mFiles as $f) {
            
            $result =             Mail::Send(
                (int) $idLang,
                $f,
                Context::getContext()->getTranslator()->trans(
                    'Your guest account has been transformed into a customer account',
                    array(),
                    'Emails.Subject',
                    $language->locale
                ),
                null,
                'your@email.com',
                null,
                null,
                null,
                null,
                null,
                _PS_MAIL_DIR_,
                false,
                (int) $this->id_shop
            );
        }
        die($result === true ? 'ok' : $result);

 

  • Confused 1
Link to comment
Share on other sites

  • 1 month later...

I'm having the same need. Your solution looks perfect but... I just don't know how to run it. Can you please give a bit more detail of how to apply and run your solution? Many thanks in advance!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...