In my last project, I designed new newsletter template and created custom newsletter administration area. When I send newsletter to admin to test the email, it does not send HTML email but plain text mail. Scratching my head, I searched Zencart documentation as well as Google for couple hours to find the answer. Now, I will share the solution here, just in case you go through the same pain as me.
First of all, you need to configure your Zencart to use HTML type email. Login to your administrator area and go to configuration > E-mail options.
- Make sure your “E-Mail Transport Method” is set appropriately
- Use MIME HTML When Sending Emails = “true”
- Send E-Mails = true
- Email Admin Format? = HTML
Now try to send a newsletter to the admin, if it still sends plain text mail, do the following. Backup and open in your text editor includes/functions/functions_email.php. In your functions_email.php try to find these codes
120 121 122 | if (ADMIN_EXTRA_EMAIL_FORMAT == 'TEXT' && substr($module,-6)=='_extra') { $email_html=''; // just blank out the html portion if admin has selected text-only } |
Just below that add the following codes
125 126 127 128 | // if no customer email record found, and admin email format is set to HTML, and sending newsletter, and admin is logged in, use HTML: if ($customers_email_format_read->RecordCount() == 0 && ADMIN_EXTRA_EMAIL_FORMAT == 'HTML' && in_array($module, array('newsletters', 'product_notification')) && isset($_SESSION['admin_id'])) { $customers_email_format = 'HTML'; } |
Now, you should send email in HTML format. Leave comment if it does not work for you or if this post has helped you and save your time.
Thanks a lot.
This works perfectly and solved the problem.
zencart 1.38.a .Not success.
Not get the html email .
Please more suggest.thanks!
tried it, turned ever page blank both admin and store? soon as I removed the code, website working again?? running v1.3.9h, maybe that was the problem?
Thanks anyways.