Change contact us mail template to HTML

Potential buyers can contact a store owner through email in Magento. But when you try to reply to those emails you cannot send links or other HTML content in it because by default contact mail templates in Magento are ‘text’ based. I am going to show a quick way to change the type of those templates into HTML.

Open your module’s config file. For us it is contacts module. I’d recommend that you copy it in local first and then make changes. So after copying open the file and find the code like this about the end of the file:

<template>
    <email>
        <contacts_email_email_template translate="label" module="contacts">
            <label>Contact Form</label>
            <file>contact_form.html</file>
            <type>text</type>
        </contacts_email_email_template>
    </email>
</template>

text defines the type of the email template. All you need to do is change that to ‘html’ and we’re done. The resulting code will look like this:

<template>
    <email>
        <contacts_email_email_template translate="label" module="contacts">
            <label>Contact Form</label>
            <file>contact_form.html</file>
            <type>html</type>
        </contacts_email_email_template>
    </email>
</template>

Once you have changed the type of template you can easily check it from your store’s admin. Go to System->Transactional Emails and click on Add new template. Select Contact Form email to load the new template from. Give a new name for your new template and save the template. You’ll see the list of templates in the grid from where you can check the type of the template. It will be converted to HTML instead of TEXT.

contact-us-email-template

It is not just confined to contacts template. You can make this change to any module’s config file that supports sending mails and change the email template type. It would also work the other way around. You can make an HTML template into TEXT if that is the requirement.

Hope it helps someone. Happy Coding 🙂

Speak Your Mind

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: