Getting HTML of transactional emailsFormatting transactional emailsSending out transactional emails manuallyWYSIWYG editor for transactional emailsSome transactional emails are not being sentCan't send emailsBASE64_LENGTH_79_INF: SpamAssasin penalizes transactional emailsOverriding Core File in MagentoMagento 2 Sending emails triggered by observerTransactional emails: centering an imageTransactional Emails not sending

Where is Jon going?

How was Daenerys able to legitimise Gendry?

Is keeping the forking link on a true fork necessary (Github/GPL)?

Apart from the sine wave, are there any other waveshapes that could be thought of as commonly appearing "in nature"?

Job Market: should one hide their (young) age?

Grade-school elementary algebra presented in an abstract-algebra style?

How would a developer who mostly fixed bugs for years at a company call out their contributions in their CV?

What weight should be given to writers groups critiques?

Natural Armour and Weapons

Can a tabaxi rogue with the Criminal background start with 8 skill proficiencies?

Freedom of Speech and Assembly in China

Why isn't Tyrion mentioned in the in-universe book "A Song of Ice and Fire"?

What is the use case for non-breathable waterproof pants?

Is my plasma cannon concept viable?

Dad jokes are fun

What are nvme namespaces? How do they work?

Can a ring of spell storing and access to Find spells produce an endless menagerie?

Writing style before Elements of Style

Need to read my home electrical Meter

What does it mean when a vocal teacher tell you that your lowest notes are heavy?

First Program Tic-Tac-Toe

Would Buddhists help non-Buddhists continuing their attachments?

Time complexity of an algorithm: Is it important to state the base of the logarithm?

What tokens are in the end of line?



Getting HTML of transactional emails


Formatting transactional emailsSending out transactional emails manuallyWYSIWYG editor for transactional emailsSome transactional emails are not being sentCan't send emailsBASE64_LENGTH_79_INF: SpamAssasin penalizes transactional emailsOverriding Core File in MagentoMagento 2 Sending emails triggered by observerTransactional emails: centering an imageTransactional Emails not sending






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5















I would like to know if it's possible to get code html of transactional emails before send email to user with template variables etc. I overrided _sendEmailTemplate and I try to get html code in this way:



protected function _sendEmailTemplate($template, $sender, $templateParams = array(), $storeId = null) 
/** @var $mailer Mage_Core_Model_Email_Template_Mailer */
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($this->getEmail(), $this->getName());
$mailer->addEmailInfo($emailInfo);

// Set all required params and send emails
$mailer->setSender(Mage::getStoreConfig($sender, $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId(Mage::getStoreConfig($template, $storeId));
$mailer->setTemplateParams($templateParams);
$emailTemplate = Mage::getModel('core/email_template')->loadByCode($template); // I try to get template


$processedTemplate = $emailTemplate->getProcessedTemplate($templateParams); //set template variables and get html code
print_R($processedTemplate);
exit;
$mailer->send();
return $this;



Comments in code.
It doesn't work. Any ideas will be appreciated










share|improve this question
























  • app/code/core/Mage/Core/Model/Email/Template.php Check send function there you can echo html of email and you can save it

    – Rohit Kundale
    Jan 13 '16 at 10:02


















5















I would like to know if it's possible to get code html of transactional emails before send email to user with template variables etc. I overrided _sendEmailTemplate and I try to get html code in this way:



protected function _sendEmailTemplate($template, $sender, $templateParams = array(), $storeId = null) 
/** @var $mailer Mage_Core_Model_Email_Template_Mailer */
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($this->getEmail(), $this->getName());
$mailer->addEmailInfo($emailInfo);

// Set all required params and send emails
$mailer->setSender(Mage::getStoreConfig($sender, $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId(Mage::getStoreConfig($template, $storeId));
$mailer->setTemplateParams($templateParams);
$emailTemplate = Mage::getModel('core/email_template')->loadByCode($template); // I try to get template


$processedTemplate = $emailTemplate->getProcessedTemplate($templateParams); //set template variables and get html code
print_R($processedTemplate);
exit;
$mailer->send();
return $this;



Comments in code.
It doesn't work. Any ideas will be appreciated










share|improve this question
























  • app/code/core/Mage/Core/Model/Email/Template.php Check send function there you can echo html of email and you can save it

    – Rohit Kundale
    Jan 13 '16 at 10:02














5












5








5








I would like to know if it's possible to get code html of transactional emails before send email to user with template variables etc. I overrided _sendEmailTemplate and I try to get html code in this way:



protected function _sendEmailTemplate($template, $sender, $templateParams = array(), $storeId = null) 
/** @var $mailer Mage_Core_Model_Email_Template_Mailer */
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($this->getEmail(), $this->getName());
$mailer->addEmailInfo($emailInfo);

// Set all required params and send emails
$mailer->setSender(Mage::getStoreConfig($sender, $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId(Mage::getStoreConfig($template, $storeId));
$mailer->setTemplateParams($templateParams);
$emailTemplate = Mage::getModel('core/email_template')->loadByCode($template); // I try to get template


$processedTemplate = $emailTemplate->getProcessedTemplate($templateParams); //set template variables and get html code
print_R($processedTemplate);
exit;
$mailer->send();
return $this;



Comments in code.
It doesn't work. Any ideas will be appreciated










share|improve this question
















I would like to know if it's possible to get code html of transactional emails before send email to user with template variables etc. I overrided _sendEmailTemplate and I try to get html code in this way:



protected function _sendEmailTemplate($template, $sender, $templateParams = array(), $storeId = null) 
/** @var $mailer Mage_Core_Model_Email_Template_Mailer */
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($this->getEmail(), $this->getName());
$mailer->addEmailInfo($emailInfo);

// Set all required params and send emails
$mailer->setSender(Mage::getStoreConfig($sender, $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId(Mage::getStoreConfig($template, $storeId));
$mailer->setTemplateParams($templateParams);
$emailTemplate = Mage::getModel('core/email_template')->loadByCode($template); // I try to get template


$processedTemplate = $emailTemplate->getProcessedTemplate($templateParams); //set template variables and get html code
print_R($processedTemplate);
exit;
$mailer->send();
return $this;



Comments in code.
It doesn't work. Any ideas will be appreciated







magento-1.9 email html






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 2 '18 at 23:05









sv3n

10.1k62557




10.1k62557










asked Jan 13 '16 at 9:57









coreycorey

416




416












  • app/code/core/Mage/Core/Model/Email/Template.php Check send function there you can echo html of email and you can save it

    – Rohit Kundale
    Jan 13 '16 at 10:02


















  • app/code/core/Mage/Core/Model/Email/Template.php Check send function there you can echo html of email and you can save it

    – Rohit Kundale
    Jan 13 '16 at 10:02

















app/code/core/Mage/Core/Model/Email/Template.php Check send function there you can echo html of email and you can save it

– Rohit Kundale
Jan 13 '16 at 10:02






app/code/core/Mage/Core/Model/Email/Template.php Check send function there you can echo html of email and you can save it

– Rohit Kundale
Jan 13 '16 at 10:02











2 Answers
2






active

oldest

votes


















0














It depends on what you want to do with the HTML code, but what I used to do to debug emails is log the email HTML code into a file.



Instead of using print_r, you can do:



Mage::log($processedTemplate, null, sprintf("email_%s.html", date("Ymd-his")));





share|improve this answer























  • I want to save content of all HTML code in file on my harddisk for example :)

    – corey
    Jan 13 '16 at 10:02











  • The $processedTemplate variable contains the HTML of the email, from that point you can do whatever you want with it, just ensure your email is still being sent after you wrote your code.

    – Raphael at Digital Pianism
    Jan 13 '16 at 10:12











  • However I execute your Mage::log after send email, I can't get properly my HTML code, I don't know why because I check new email_2016-0113-101610.html and it's doesn't contain nothing instead of DEBUG and it's all. I don't get HTML code.

    – corey
    Jan 13 '16 at 10:18











  • Ok, I got it. It was simple: $mailer->getProcessedTemplate($templateVariables) instead of create new variable $emailTemplate

    – corey
    Jan 13 '16 at 10:26



















0














Have you considered installing an extension such as this



https://www.yireo.com/software/magento-extensions/emailtester






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f97003%2fgetting-html-of-transactional-emails%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    It depends on what you want to do with the HTML code, but what I used to do to debug emails is log the email HTML code into a file.



    Instead of using print_r, you can do:



    Mage::log($processedTemplate, null, sprintf("email_%s.html", date("Ymd-his")));





    share|improve this answer























    • I want to save content of all HTML code in file on my harddisk for example :)

      – corey
      Jan 13 '16 at 10:02











    • The $processedTemplate variable contains the HTML of the email, from that point you can do whatever you want with it, just ensure your email is still being sent after you wrote your code.

      – Raphael at Digital Pianism
      Jan 13 '16 at 10:12











    • However I execute your Mage::log after send email, I can't get properly my HTML code, I don't know why because I check new email_2016-0113-101610.html and it's doesn't contain nothing instead of DEBUG and it's all. I don't get HTML code.

      – corey
      Jan 13 '16 at 10:18











    • Ok, I got it. It was simple: $mailer->getProcessedTemplate($templateVariables) instead of create new variable $emailTemplate

      – corey
      Jan 13 '16 at 10:26
















    0














    It depends on what you want to do with the HTML code, but what I used to do to debug emails is log the email HTML code into a file.



    Instead of using print_r, you can do:



    Mage::log($processedTemplate, null, sprintf("email_%s.html", date("Ymd-his")));





    share|improve this answer























    • I want to save content of all HTML code in file on my harddisk for example :)

      – corey
      Jan 13 '16 at 10:02











    • The $processedTemplate variable contains the HTML of the email, from that point you can do whatever you want with it, just ensure your email is still being sent after you wrote your code.

      – Raphael at Digital Pianism
      Jan 13 '16 at 10:12











    • However I execute your Mage::log after send email, I can't get properly my HTML code, I don't know why because I check new email_2016-0113-101610.html and it's doesn't contain nothing instead of DEBUG and it's all. I don't get HTML code.

      – corey
      Jan 13 '16 at 10:18











    • Ok, I got it. It was simple: $mailer->getProcessedTemplate($templateVariables) instead of create new variable $emailTemplate

      – corey
      Jan 13 '16 at 10:26














    0












    0








    0







    It depends on what you want to do with the HTML code, but what I used to do to debug emails is log the email HTML code into a file.



    Instead of using print_r, you can do:



    Mage::log($processedTemplate, null, sprintf("email_%s.html", date("Ymd-his")));





    share|improve this answer













    It depends on what you want to do with the HTML code, but what I used to do to debug emails is log the email HTML code into a file.



    Instead of using print_r, you can do:



    Mage::log($processedTemplate, null, sprintf("email_%s.html", date("Ymd-his")));






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 13 '16 at 10:01









    Raphael at Digital PianismRaphael at Digital Pianism

    55.7k22126286




    55.7k22126286












    • I want to save content of all HTML code in file on my harddisk for example :)

      – corey
      Jan 13 '16 at 10:02











    • The $processedTemplate variable contains the HTML of the email, from that point you can do whatever you want with it, just ensure your email is still being sent after you wrote your code.

      – Raphael at Digital Pianism
      Jan 13 '16 at 10:12











    • However I execute your Mage::log after send email, I can't get properly my HTML code, I don't know why because I check new email_2016-0113-101610.html and it's doesn't contain nothing instead of DEBUG and it's all. I don't get HTML code.

      – corey
      Jan 13 '16 at 10:18











    • Ok, I got it. It was simple: $mailer->getProcessedTemplate($templateVariables) instead of create new variable $emailTemplate

      – corey
      Jan 13 '16 at 10:26


















    • I want to save content of all HTML code in file on my harddisk for example :)

      – corey
      Jan 13 '16 at 10:02











    • The $processedTemplate variable contains the HTML of the email, from that point you can do whatever you want with it, just ensure your email is still being sent after you wrote your code.

      – Raphael at Digital Pianism
      Jan 13 '16 at 10:12











    • However I execute your Mage::log after send email, I can't get properly my HTML code, I don't know why because I check new email_2016-0113-101610.html and it's doesn't contain nothing instead of DEBUG and it's all. I don't get HTML code.

      – corey
      Jan 13 '16 at 10:18











    • Ok, I got it. It was simple: $mailer->getProcessedTemplate($templateVariables) instead of create new variable $emailTemplate

      – corey
      Jan 13 '16 at 10:26

















    I want to save content of all HTML code in file on my harddisk for example :)

    – corey
    Jan 13 '16 at 10:02





    I want to save content of all HTML code in file on my harddisk for example :)

    – corey
    Jan 13 '16 at 10:02













    The $processedTemplate variable contains the HTML of the email, from that point you can do whatever you want with it, just ensure your email is still being sent after you wrote your code.

    – Raphael at Digital Pianism
    Jan 13 '16 at 10:12





    The $processedTemplate variable contains the HTML of the email, from that point you can do whatever you want with it, just ensure your email is still being sent after you wrote your code.

    – Raphael at Digital Pianism
    Jan 13 '16 at 10:12













    However I execute your Mage::log after send email, I can't get properly my HTML code, I don't know why because I check new email_2016-0113-101610.html and it's doesn't contain nothing instead of DEBUG and it's all. I don't get HTML code.

    – corey
    Jan 13 '16 at 10:18





    However I execute your Mage::log after send email, I can't get properly my HTML code, I don't know why because I check new email_2016-0113-101610.html and it's doesn't contain nothing instead of DEBUG and it's all. I don't get HTML code.

    – corey
    Jan 13 '16 at 10:18













    Ok, I got it. It was simple: $mailer->getProcessedTemplate($templateVariables) instead of create new variable $emailTemplate

    – corey
    Jan 13 '16 at 10:26






    Ok, I got it. It was simple: $mailer->getProcessedTemplate($templateVariables) instead of create new variable $emailTemplate

    – corey
    Jan 13 '16 at 10:26














    0














    Have you considered installing an extension such as this



    https://www.yireo.com/software/magento-extensions/emailtester






    share|improve this answer



























      0














      Have you considered installing an extension such as this



      https://www.yireo.com/software/magento-extensions/emailtester






      share|improve this answer

























        0












        0








        0







        Have you considered installing an extension such as this



        https://www.yireo.com/software/magento-extensions/emailtester






        share|improve this answer













        Have you considered installing an extension such as this



        https://www.yireo.com/software/magento-extensions/emailtester







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 16 at 21:36









        Dominic XigenDominic Xigen

        39810




        39810



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f97003%2fgetting-html-of-transactional-emails%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?