Forums / General Questions / HTML customer emails not working

HTML customer emails not working

Locked

Started by sonnie on 17 May 2007, 1:52 AM · Views: 6,554

Results 1 to 20 of 25
This thread is locked. New replies are disabled.
17 May 2007, 1:52 AM
#1
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

HTML customer emails not working

Setting up Zen Cart 1.3.7. Been going well, most all answers found in FAQ and searching the Forum. I have the Customer Default Email Preference in Admin>Config>Customer Details set to 1, HTML, but all emails are being received in text only. The welcome, order info, tell a friend, etc. However, the Admin notification emails are coming through as HTML. What am I missing?

17 May 2007, 7:22 AM
#2
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Location:
Papworth, Cambridgeshire, UK
Posts:
717
Plugin Contributions:
0

Re: HTML customer emails not working

Now thats a new twist, normally it's the other way around!
Check that you have Admin-Config-Email Options- Use Mime set to true, and check your customer email preferences settings for individual customers. I believe many earlier versions of ZC defaulted to 'TEXT'.

17 May 2007, 12:33 PM
#3
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: HTML customer emails not working

Also, is this a fresh installation of Zen-Cart v1.37 or an upgrade from earlier versions ?

17 May 2007, 2:27 PM
#4
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

Re: HTML customer emails not working

Chuckl:

Now thats a new twist, normally it's the other way around!
Check that you have Admin-Config-Email Options- Use Mime set to true, and check your customer email preferences settings for individual customers. I believe many earlier versions of ZC defaulted to 'TEXT'.

Mime HTML is set to true. Customer individual email preferences set to HTML. I have also tried PHP and Sendmail as transport methods. This is a fresh install of ZC 1.37. I thought I read in another post of someone having similar problems using PHP 5.X? My host server is running PHP 5.1.6. I am not using any newsletter options.

17 May 2007, 2:48 PM
#5
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Location:
Papworth, Cambridgeshire, UK
Posts:
717
Plugin Contributions:
0

Re: HTML customer emails not working

Customers receiving text emails rather than HTML is usually tied in with the web based email services - gmail, yahoo, hotmail etc.
Typical fixes are to ensure that the admin/includes/extra_configures folder has a copy of the /includes/extra_configures - email_use_8bit.php file, and often you need to use sendmail -f, and/or set Send From Known Domain to true.
I'm not aware of any specific PHP 5.X problems, I use nothing else but.
That said, it is a commonly voiced opinion that I'm not aware of a lot of things, so I'm happy to be enlightened.

17 May 2007, 3:45 PM
#6
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

Re: HTML customer emails not working

Chuckl:

Customers receiving text emails rather than HTML is usually tied in with the web based email services - gmail, yahoo, hotmail etc.
Typical fixes are to ensure that the admin/includes/extra_configures folder has a copy of the /includes/extra_configures - email_use_8bit.php file, and often you need to use sendmail -f, and/or set Send From Known Domain to true.
I'm not aware of any specific PHP 5.X problems, I use nothing else but.
That said, it is a commonly voiced opinion that I'm not aware of a lot of things, so I'm happy to be enlightened.

I have tested the emails on non-web based addresses, no difference. However, I do not have the file email_use_8bit.php in the admin/includes/extra_configures folder on the server. The only two files I have in this folder are index.html and media_manager.php. I have not tried sendmail -f yet, or set Send From Known Domain to true. How important is the email_use_8bit.php file, and why might I be missing It? And by the way Chuckl, many thanks for your replies, much appreciated!

17 May 2007, 4:05 PM
#7
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Location:
Papworth, Cambridgeshire, UK
Posts:
717
Plugin Contributions:
0

Re: HTML customer emails not working

You're welcome.

The email_use_8bit is used to select the mime encoding. By default it is set to 8bit, hence the file name, as it contains a define for the email encoding method. If that define is commented out, or the file is not present, it changes to 7bit default.
What this means is that if you do not put a copy of this in the admin/includes/extra_configures, any email sent via the admin section loves to default to 7bit encoding, so it is a good idea to put a copy there, just to ensure that 8bit is selected.
The send from known domain and sendmail -f are essentially the same thing, they replace the usual from address of the shop mail - usually user www-data or similar with the shop Email From address, which is usually a more sensible [email protected] or similar. This seems to make quite a few mail systems happier to accept HTML mail.

17 May 2007, 4:09 PM
#8
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Location:
Papworth, Cambridgeshire, UK
Posts:
717
Plugin Contributions:
0

Re: HTML customer emails not working

The fact that your Admin notifications are coming through as HTML also suggests that there is nothing too much wrong with your settings, but that dodgy encoding settings or security are causing the HTML to be ditched.

17 May 2007, 4:23 PM
#9
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

Re: HTML customer emails not working

Thank you. I will try using the sendmail -f method and send from known domain. According to the headers, the emails being received show Content-Tranfer-Encoding as 8bit. I am assuming I can find the file email_use_8bit.php somewhere else within the ZC files.

17 May 2007, 4:39 PM
#10
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Location:
Papworth, Cambridgeshire, UK
Posts:
717
Plugin Contributions:
0

Re: HTML customer emails not working

Yup, in /includes/extra_configures/ i.e. the shop includes folder chain, rather than the admin one.
In my lurching around with this stuff, I saw several cases where the encoding was labelled as 8bit, but actually 7bit and vice versa, hence the HTML mail being dumped as suspect.

17 May 2007, 6:03 PM
#11
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

Re: HTML customer emails not working

Well shucks (expletive replacement), I have tried about every combination possible. I must say my hosting is quite tolerant of just about all of the settings I have tried. Sends emails out just fine, just not in HTML. This is certainly not a crisis, as long as emails are sent, confirmations, orders, etc. I just believe HTML emails look more professional. Thank you Chuckl for all of your help. If someone stumbles across this thread with another idea, please post.

17 May 2007, 6:33 PM
#12
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Location:
Papworth, Cambridgeshire, UK
Posts:
717
Plugin Contributions:
0

Re: HTML customer emails not working

There is the remote possibility that your host uses 7bit mime for emails. Which would also explain why your admin emails come through fine.(Admin defaults to 7bit).

To test that, edit the 2 email_use_8bit.php files and change the define from 8bit to 7bit.

Rgds,

17 May 2007, 9:46 PM
#13
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

Re: HTML customer emails not working

Chuckl:

There is the remote possibility that your host uses 7bit mime for emails. Which would also explain why your admin emails come through fine.(Admin defaults to 7bit).

To test that, edit the 2 email_use_8bit.php files and change the define from 8bit to 7bit.

Rgds,

I contacted support at my host, who stated they use 8bit mime. However I edited the files above, the results were the same. Emails sent as text.

19 May 2007, 2:48 AM
#14
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

Re: HTML customer emails not working

Well, after tons of trials and errors I've found something interesting.

I have the Configuration>Customer Details - Customer Default Email Preference set to 1 (HTML)

If I look in Customers>Customers>Edit, it shows the customer's Email Format Pref: as HTML

However, if the customer is logged in, goes to My Account>View or Change my account information, the Newsletter and Email Details shows the TEXT-Only radio button marked. If that is changed to HTML, updated, then all subsequent emails are then sent as HTML.

I am not using newsletters and there is no email preference choice on the sign up page.

So what is happening with the Customer Default Email Preference setting in the configuration?

And why is it showing the customer's Email Format Pref: as HTML?

19 May 2007, 6:50 AM
#15
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Location:
Papworth, Cambridgeshire, UK
Posts:
717
Plugin Contributions:
0

Re: HTML customer emails not working

Thats often caused by a 'constant variable', something that is user selectable in one place is hard coded in somewhere else.
Might be related to the posts on this page

http://www.zen-cart.com/forum/showthread.php?t=37185&page=44

19 May 2007, 4:32 PM
#16
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

Re: HTML customer emails not working

Chuckl:

Thats often caused by a 'constant variable', something that is user selectable in one place is hard coded in somewhere else.
Might be related to the posts on this page

http://www.zen-cart.com/forum/showthread.php?t=37185&page=44

Thanks Chuckl, I looked through the above thread, but nothing really popped out as to what I might be looking for. I'll keep going through it.

Way back in my DOS programming days, unless otherwise defined, variables defaulted to values (ie String Variables to NULL, Integers to 0, etc. Would it not be possible upon customer signup to initially hard-code in the customer's email preference variable (whatever that is) to HTML? Could this be done in create_account.php? And by the way, what IS that variable?

19 May 2007, 5:15 PM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: HTML customer emails not working

  1. What version of Zen Cart? (I believe you said 1.3.7 a bit ago)
  2. Was this a fresh install or an upgrade? from what version?
  3. What contributions/addons do you have installed?
  4. What customizations have you made to the create-account process?
  • /includes/modules/create_account.php
  • /includes/modules/pages/create_account/header_php.php
  • /includes/templates/YOURTEMPLATE/templates/tpl_create_account_default.php
    and any other files related to the create-account infrastructure?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

19 May 2007, 5:27 PM
#18
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

Re: HTML customer emails not working

DrByte:

  1. What version of Zen Cart? (I believe you said 1.3.7 a bit ago)
  2. Was this a fresh install or an upgrade? from what version?
  3. What contributions/addons do you have installed?
  4. What customizations have you made to the create-account process?
  • /includes/modules/create_account.php
  • /includes/modules/pages/create_account/header_php.php
  • /includes/templates/YOURTEMPLATE/templates/tpl_create_account_default.php
    and any other files related to the create-account infrastructure?

Hi DrByte,

Version 1.3.7
Fresh install using Fantastico on my server
No addons
No customizations of any files (that I know of).
Used the Admin panel to set my preferences for the store.

19 May 2007, 5:40 PM
#19
sonnie avatar

sonnie

New Zenner

Join Date:
May 2007
Location:
Oregon Coast
Posts:
15
Plugin Contributions:
0

Re: HTML customer emails not working

Just did a check on the database. After a customer signs up, the customer_email_format field is null (blank). This field is not being written to during signup. However, if a customer accesses their account, updates, then the field is written to.

19 May 2007, 5:47 PM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: HTML customer emails not working

You mentioned that you have turned off the newsletter-selection box for customers. However, since the email-format-preference is determined in that section of the page, since you have supressed the ability for the customer to make such selection, it is being set to the database-default of TEXT.
To override that, do the following:
edit /includes/modules/create_account.php
around line 25, you see:```
$zone_id = 0;
$error = false;
/**

  • Process form contents
    /
    insert two new lines in the middle of that, as shown:
    $zone_id = 0;
    $error = false;
    [B] $email_format = (ACCOUNT_EMAIL_PREFERENCE == '1' ? 'HTML' : 'TEXT');
    $newsletter = (ACCOUNT_NEWSLETTER_STATUS == '1' ? false : true);
    [/B]
    /
    *
  • Process form contents
    */
    You can then remove these lines from 429-430, as they will now be redundant:
    if (!isset($email_format)) $email_format = (ACCOUNT_EMAIL_PREFERENCE == '1' ? 'HTML' : 'TEXT');
    if (!isset($newsletter)) $newsletter = (ACCOUNT_NEWSLETTER_STATUS == '1' ? false : true);
Now all new customers will get the preference selected by the administrator, rather than their own choice.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.