search
top

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 Responses to “List of Email Templates in Magento”

  1. Anne Maria says:

    Thanks for your help

  2. Raph says:

    Great work man, was looking for this =)

  3. Marshall House says:

    Perfect.

  4. Neeraj says:

    Thanks..

Leave a Reply

top