Here is my code:

$mailData = array(
   'data' => $data

$emailTemplate = Mage::getModel('core/email_template')->loadByCode('templateName');

$emailTemplate->send(aray('FIRST RECEIVER', 'SECOND RECEIVER'), array('[email protected]', '[email protected]'), $mailData);

What I want is get the current receiver email, like:

{{var current_receiver_email}}

Notice that I have 2 receivers ([email protected], [email protected]), that are been send to "same time".

How to print [email protected] when the email is send to [email protected]?

And [email protected] when the email is send to [email protected]?

1 Answer 1


You can use below code to send transactional email

$templateId = 1;

    // Set sender information            
    $senderName = Mage::getStoreConfig('trans_email/ident_support/name');
    $senderEmail = Mage::getStoreConfig('trans_email/ident_support/email');        
    $sender = array('name' => $senderName,
                'email' => $senderEmail);

    // Set recepient information
    $recepientEmail = '[email protected]';
    $recepientName = 'John Doe';        

    // Get Store ID        
    $store = Mage::app()->getStore()->getId();

    // Set variables that can be used in email template
    $vars = array('customerName' => '[email protected]',
              'customerEmail' => 'Mr. Nil Cust','recipient_email'=>$recepientEmail);

    $translate  = Mage::getSingleton('core/translate');

    // Send Transactional Email
    Mage::getModel('core/email_template')->addBcc('[email protected]')          ->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars, $storeId);


You can access recipient email via {{var recipient_email}}

I have also added Bcc to email.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.