in magento on order confirmation email is sent to admin in HTML format,
but i want to change it to plain text format so how and from where i can change that format only for admin, customer should get email in HTMl format as it is.
Can anyone please give me solution for this?
Thanks.
First create custom email template from Transactions emails
and text type set as plain. Note down that template Id. and use in below file.
At \app\code\local\Mage\Sales\Model\Order.php
sendNewOrderEmail()
load manually template is and sent variables to that and send email.
For future readers, do not edit core files as others suggest. You can achieve this in config alone with a tiny custom module.
I have AheadWorks' blog module installed, you may not, or you may have other modules that need their email format overridden. So, adjust accordingly.
Create app/etc/modules/YourNameSpace_EmailFormat.xml
and add to <depends>
, so your config is loaded last:
<?xml version="1.0"?>
<config>
<modules>
<YourNameSpace_EmailFormat>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Contacts/>
<AW_Blog/>
</depends>
</YourNameSpace_EmailFormat>
</modules>
</config>
Create app/code/local/YourNameSpace/EmailFormat/etc/config.xml
, adding elements for all the templates you wish to override:
<?xml version="1.0"?>
<config>
<modules>
<YourNameSpace_EmailFormat>
<version>1</version>
</YourNameSpace_EmailFormat>
</modules>
<global>
<template>
<email>
<customer_create_account_email_template>
<type>text</type>
</customer_create_account_email_template>
</email>
</template>
</global>
</config>
That's it. I needed the reverse, so I had <type>
set to html
. This goes very well with Yireo's Email Override module so you can easily customise your templates. If converting plain text emails to HTML, be sure to change template tags like {{var foo.bar}}
to {{htmlescape var=$foo.bar}}
to prevent malicious code injections.
you have to override and extend the Mage_Core_Model_Email_Template
model to achieve this and set the correct header from there and you can't separate those by user and you ahve to build your own logic for that