B-219 Sec-55 Noida, India

Send Email programmatically using magento

include “app/Mage.php”;
ini_set(“display_errors”, 1);

// The Id you just marked from the transactional email template id
$templateId = 1;

// Define the sender, here we query Magento default email (in the configuration)
// For customer support email, use : ‘trans_email/ident_support/…’
$sender = Array(‘name’ => Mage::getStoreConfig(‘trans_email/ident_general/name’),
                ’email’ => Mage::getStoreConfig(‘trans_email/ident_general/email’));

// Set you store
// This information may be taken from the current logged in user
$store = Mage::app()->getStore();

// In this array, you set the variables you use in your template
$vars = Array(‘my_var’ => $my_var,
              ‘another_var’ => 12);

// You don’t care about this…       
$translate  = Mage::getSingleton(‘core/translate’);

// Send your email
                                                         ‘[email protected]’,
                                                         ‘Recipient Name’,

// You don’t care as well       

(Visited 98 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.