Zen Cart Logo
Forums / Bug Reports / [Done 1.3.9] Storage of email_html in email_archive table problematic

[Done 1.3.9] Storage of email_html in email_archive table problematic

Locked

Views: 2,615

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
27 Sep 2008, 12:48 AM
#1
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

[Done 1.3.9] Storage of email_html in email_archive table problematic

The way HTML email are stored is incompatible with retransmission using the zen_mail function, since the $block variable cannot easily be reconstructed. As a suggested workaround, a plain text email could be resent easily if the following change was made to functions_email.php:

If the $module value 'resend" is used, blank out email_html right before the AFTER_EMAIL_FORMAT_DETERMINED notifier i.e.

  if ($module == 'resend') {
    $email_html='';  // just blank out the html portion if resend from admin
  }
  //notifier intercept option
  $zco_notifier->notify('NOTIFY_EMAIL_AFTER_EMAIL_FORMAT_DETERMINED');

This change would allow the Email Archive Manager to be able to resend at least text based email when the customer's email preference is HTML and the Store has Configuration->Email Options->Use Mime HTML set to true.

Thanks,
Scott

12 May 2009, 6:56 PM
#2
drbyte avatar

drbyte

Sensei

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

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

swguy:

The way HTML email are stored is incompatible with retransmission using the zen_mail function, since the $block variable cannot easily be reconstructed.
Can you elaborate on the difficulties of reconstructing?

14 May 2009, 9:30 AM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

Unless there's an inverse to zen_build_html_email_from_template() that turns an $html_email into a $block, it doesn't look possible to me. Am I missing something? How would you propose to regenerate the block array from what is stored in the email_html column?

14 May 2009, 5:27 PM
#4
drbyte avatar

drbyte

Sensei

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

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

Well, since the HTML content is stored in the database as the actual HTML sent, there's no need to process the data as a template.

So maybe it's best to change this line:$email_html = zen_build_html_email_from_template($module, $block);to this:```
$email_html = [B](!is_array($block) && substr($block, 0, 6) == '<html>') ? $block : [/B]zen_build_html_email_from_template($module, $block);

14 May 2009, 9:59 PM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

Nice!

Say, while you're in there :smile: could we please have a parameter to force text-only email? This frees you from the need to build a new template.

14 May 2009, 10:54 PM
#6
drbyte avatar

drbyte

Sensei

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

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

Not sure what exactly you mean.

14 May 2009, 11:39 PM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

I'd like one of the parms to zen_mail to be "force the use of plain txt" so it doesn't look for a template.

15 May 2009, 2:14 AM
#8
drbyte avatar

drbyte

Sensei

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

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

In terms of re-sending an email via the admin addon?

15 May 2009, 4:53 AM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

Just meant in terms of possible changes to includes/functions/functions_email.php (since you were in there anyway).

15 May 2009, 5:14 AM
#10
drbyte avatar

drbyte

Sensei

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

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

Cool. There are lots of improvements in that area in 2.0, including the ability to specify text-only (a good case for that is XML-only content and such), etc. The entire email content has been split off into templates, for both text and html content, with lots of parameter options available. Further details will be furnished around the time of release.

15 May 2009, 5:21 AM
#11
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

Re: [Done 1.3.9] Storage of email_html in email_archive table problematic

Looking forward to it! :smile: Thanks.