List of Email Templates in Magento

I am posting here the method to get the list of Email Templates which we make at admin end (Admin Panel -> System -> Transactional Emails)

The below code to be written in Block file.

<?php 
	$template_info = array();
    	$template_collection =  Mage::getResourceSingleton('core/email_template_collection');
    	if(!empty($template_collection))
    	{
	    	$cnt = 0;
			foreach($template_collection as $template)
			{
			   $template_info[$cnt]['id'] = $template->getTemplateId();
			   $template_info[$cnt]['code'] = $template->getTemplateCode();
			   $cnt++;
			}   	
		if(!empty($template_info))
	    	{
	    		print_r($template_info);
	    	}else
	    	{
	    		Mage::getSingleton('adminhtml/session')->addError('No templates found');
			    return false;	
	    	}	
    	}else
    	{
    		Mage::getSingleton('adminhtml/session')->addError('No templates found');
		    return false;	
    	}	
?>

Hope this is helpful.

4 thoughts on “List of Email Templates in Magento

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top