Magento 1.9 Transactional Mail – How to Add Customer Email to Transactional Emails

magento-1.9transactional-mail

How do I add the customers e-mail to the sales transaction e-mail? At the moment I include the shipping and billing details but these only include the address and telephone number. How do I add the customers email address (I can't see the variable on the admin side) – is it something I need to do in FTP?

The current setup is as follows:

  {{template config_path="design/email/header"}}
  {{inlinecss file="email-inline.css"}}

  <table cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td class="email-heading">
                    <h1>Thank you for your order from {{var store.getFrontendName()}}.</h1>
                    <p>Once your package ships we will send an email with a link to track your order. Your order summary is below. Thank you again for your business.</p>
                </td>
                <td class="store-info">
                    <h4>Order Questions?</h4>
                    <p>
                        {{depend store_phone}}
                        <b>Call Us:</b>
                        <a href="tel:{{var phone}}">{{var store_phone}}</a><br>
                        {{/depend}}
                        {{depend store_hours}}
                        <span class="no-link">{{var store_hours}}</span><br>
                        {{/depend}}
                        {{depend store_email}}
                        <b>Email:</b> <a href="mailto:{{var store_email}}">{{var store_email}}</a>
                        {{/depend}}
                    </p>
                </td>
            </tr>
        </table>
    </td>
</tr>
<tr>
    <td class="order-details">
        <h3>Your order <span class="no-link">#{{var order.increment_id}}</span></h3>
        <p>Placed on {{var order.getCreatedAtFormated('long')}}</p>
    </td>
</tr>
<tr class="order-information">
    <td>
        {{if order.getEmailCustomerNote()}}
        <table cellspacing="0" cellpadding="0" class="message-container">
            <tr>
                <td>{{var order.getEmailCustomerNote()}}</td>
            </tr>
        </table>
        {{/if}}
        {{layout handle="sales_email_order_items" order=$order}}
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td class="address-details">
                    <h6>Bill to:</h6>
                    <p><span class="no-link">{{var order.getBillingAddress().format('html')}}</span></p>
                </td>
                {{depend order.getIsNotVirtual()}}
                <td class="address-details">
                    <h6>Ship to:</h6>
                    <p><span class="no-link">{{var order.getShippingAddress().format('html')}}</span></p>
                </td>
                {{/depend}}
          <td class="address-details">
                    <h6>Email:</h6>
                   <p>{{htmlescape myemail=$order.getCustomerEmail()}}</p>
           </td>
            </tr>
            <tr>
                {{depend order.getIsNotVirtual()}}
                <td class="method-info">
                    <h6>Shipping method:</h6>
                    <p>{{var order.shipping_description}}</p>
                </td>
                {{/depend}}
                <td class="method-info">
                    <h6>Payment method:</h6>
                    {{var payment_html}}
                </td>
            </tr>
        </table>
    </td>
</tr>
</table>
         {{template config_path="design/email/footer"}}

Best Answer

The order emails already have access to the order object. So any field or value of an order can be accessed in the mail.

In this case that would be {{var order.customer_email}}