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

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

            Get RecordId in LWC From Community PageLWC Community recordId undefinedhow to get Personal Access Token from my integrated application LWC. I am using js onlylwc quick action from Opportunity page(aura:component) and not getting @api recordIdLWC Community recordId undefinedLWC - How to get label name of buttonsLWC: Add a region in custom community themeVisual force page redirection from lightning communityLWC NavigationMixin does not work in CommunityInvoking LWC component from a plain URL - Read URL Parameter inside LWCLWC download PDF fileLWC Get Pick-list Field Values