How can I insert the customer’s email into the email templates for both guest and registered customers?

I came across this answer but it seems a bit too old now as I am using Magento 1.8. The code looks different now.

The code from the answer for app/code/core/Mage/Sales/Model/Order.php,

foreach ($sendTo as $recipient) {
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))
Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $this->getStoreId()),
'order'         => $this,
'billing'       => $this->getBillingAddress(),
'payment_html'  => $paymentBlock->toHtml(),
'guestemailvalue' => $recipient['email']

the code from the 1.8 for app/code/core/Mage/Sales/Model/Order.php,

    // Set all required params and send emails
    $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
            'order'        => $this,
            'billing'      => $this->getBillingAddress(),
            'payment_html' => $paymentBlockHtml

Any ideas?

1 Answer 1


tealau, for getting new order email goto


magento used different different email template for guest and register

find and here you find list order email and you can getusing

 {{htmlescape var=$order.getCustomerEmail()}} 
  • Thanks Amit. do I have to put that in the curly brackets like this {{var order.getBillingAddress().email()}}?
    – Run
    Aug 29, 2014 at 15:09
  • just tested it but no email printed in the email at all :(
    – Run
    Aug 29, 2014 at 15:14
  • can you tell me on which email template you have using
    – Amit Bera
    Aug 29, 2014 at 15:14
  • is neworder email ?
    – Amit Bera
    Aug 29, 2014 at 15:14
  • 1
    can you try this {{htmlescape myemail=$order.getCustomerEmail()}}
    – Amit Bera
    Aug 29, 2014 at 15:18

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.