如何在电子邮件模板中打印EAV值

I've introduced a custom EAV attribute for the customer object. Let's call it myvalue. Within several places in magento, I'm printing the value like this:

echo Mage::getSingleton('customer/session')->getCustomer()->getMyvalue();

Now, I'd like to print it to the order confirmation email template. How can I do that?

I've found the solution.

First, I created a new directory mydirectory in app/design/frontend/base/default/template/. In this directory, I put a file myvalue.phtml with the following content.

 <?php
  $customer=$this->getData('order')->getCustomer();
  print_r($customer->getMyvalue());
 ?>

And I've included this block in the email template using this line:

 {{block type='core/template' area='frontend' template='mydirecory/myvalue.phtml' order=$order}}