Hi all,
ZC 1.5.6c, MariaDB 10.3.20, PHP 7.3.11, built-in responsive classic template with Japanese support additions and a couple of modules (more info if needed).
After setting up English and Japanese spam disclaimer definitions for Japanese regulations, I realize I do not want the disclaimer on transactional mails, only on commercial mails. While I am not yet sure how to categorize all the various mail types Zen Cart is capable of sending, for now I have removed the disclaimer in mails for orders, order status changes, password forgotten, and mails deriving from the contact us form.
Problem is, I could not find a straight-forward way to do this. There are text and HTML formatted mails, all of which are sent using the zen_mail function in includes/functions/functions_email.php.
For HTML mails, the various fields for use with the HTML mail templates are actually defined one by one, and then passed to zen_mail. So for this type of mail, the spam disclaimer (while it actually does not currently seem to be used) can apparently rather simply be set to html['EMAIL_SPAM_DISCLAIMER'] => 0 in an attached array passed to zen_mail.
However, for text mails, the mails are built up from the raw defines() in the language files, which are constants. Instead of creating variables and working with those, I see in zen_mail that the disclaimers are always placed in mails, except for xml_record type mails (which I have not found being used anywhere).
My solution, very dirty for now just to test if it gets the job done, is to list inside that condition, the further mail module names for which I do not want the spam disclaimer to be sent. For now, that becomes the following:
PHP Code:
if ($module != 'xml_record') {
if (defined('EMAIL_DISCLAIMER') && EMAIL_DISCLAIMER != '' && !strstr($email_text, sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS)) && $to_email_address != STORE_OWNER_EMAIL_ADDRESS && !defined('EMAIL_DISCLAIMER_NEW_CUSTOMER')) $email_text .= "\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS);
if (($module != 'contact_us') && ($module != 'password_forgotten') && ($module != 'checkout') && ($module != 'checkout_extra') && ($module != 'order_status') && ($module != 'order_status_extra') && ($module != 'purchase_order') && ($module != 'payment_modules') && ($module != 'payment_modules_extra')) {
if (defined('EMAIL_SPAM_DISCLAIMER') && EMAIL_SPAM_DISCLAIMER != '' && !strstr($email_text, EMAIL_SPAM_DISCLAIMER) && $to_email_address != STORE_OWNER_EMAIL_ADDRESS) $email_text .= "\n\n" . EMAIL_SPAM_DISCLAIMER;
}
}
Is there any clean way to control the use of spam disclaimer, or for that matter, some differentiation of transactional and commercial mails in Zen Cart?
Any comments, insights or advice welcome.
Bookmarks