HTML Tags in %content% now possible
-
Hi.
To make it possible to also use Html Tags in the delivering templates for the %content% i changed inwp-better-emails/wpbe.php
following line:
/** Plain-text **************************************************/ // Decode body $phpmailer->AltBody = wp_specialchars_decode( $phpmailer->Body, ENT_QUOTES );
to:
/** Plain-text **************************************************/ // Decode body $phpmailer->AltBody = strip_tags(wp_specialchars_decode( $phpmailer->Body, ENT_QUOTES ));
“strip_tags” takes out now every Html Tag in the Text/Plain Version, but keeps it in Text/Html.
Maybe the plugin author can integrate it in the next update after approval.
Greets JPOG
https://www.ads-software.com/extend/plugins/wp-better-emails/
-
Hi,
As WordPress is sending all transactionnal emails in text/plain format, there is already no HTML tags in email content.
In which context do you need this ?
Hi nlemoine,
thanks for the quick answer.
I use a shop-plugin in combination with your plugin. The shop plugin makes use of “wp_mail” to send out messages to confirm orders, etc.The great thing is that your plugin sends out the message as Multipart/Mixed (Hurray!). So i wanted to have the possibility to also design the HTML “%content% as well leave the TEXT %content% visually untouched by HTML Tags.
Please visit this link. It explain quite well what i mean. Unfortunatly it is in german but at the bottom of the page you will find two screenshots of a Multipart Message made with your Plugin and the Shopplugin “wpshopgermany”.
So, what do you think about it?
Greetings. JPOG
HI JPOG,
When I have a look at the screenshots, it seems like the text version does not contain any HTML tags but maybe because you manually modified the plugin.
As the WordPress emails comes text/plain by default, I never considered removing HTML tags from email content. I’ll think about adding this modification to the plugin.
Could you just confirm we are talking about the same issue ?
Hi nlemoine,
indeed, if you look at the screenshots, it looks like there are no html-tags inside at all. It is because i changed your code like described above. The mailtemplate looks like this:
<?php /** * Template für die Mail, die bei einer neuen Bestellung an den Kunde geht */ //wpsg_debug($this->view); ?><b><?php echo wpsg_translate(__('Hallo #1# #2#,', 'wpsg'), $this->view['basket']['checkout']['vname'], $this->view['basket']['checkout']['name']); ?> </b> <b><?php echo __('Vielen Dank für Ihre Bestellung.', 'wpsg'); ?></b><br style="display:none;"> <?php if ($this->hasMod('wpsg_mod_shippingadress') && $this->callMod('wpsg_mod_shippingadress', 'check_different_shippingadress', array('k_id' => $this->view['basket']['checkout']['k_id'], 'o_id' => $this->view['o_id']))) { ?> <b><?php echo __('Rechnungsadresse:', 'wpsg'); ?></b> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Firma', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['firma']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Name', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['vname']; ?> <?php echo $this->view['basket']['checkout']['name']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Stra?e', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['strasse']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Land', 'wpsg').':', 35); ?></span><?php echo $this->db->fetchOne("SELECT <code>name</code> FROM <code>".WPSG_TBL_LAND."</code> WHERE <code>id</code> = '".wpsg_q($this->view['basket']['checkout']['land'])."' "); ?> <?php if (trim($this->view['basket']['checkout']['ustidnr']) != "") { ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('USt.IdNr.', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['ustidnr']; ?> <?php } ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Ort', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['plz']; ?> <?php echo $this->view['basket']['checkout']['ort']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Telefon', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['tel']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Fax', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['fax']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('E-Mail Adresse', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['email']; ?> <b><?php echo __('Lieferadresse:', 'wpsg'); ?> </b> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Firma', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['shipping_firma']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Name', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['shipping_vname']; ?> <?php echo $this->view['basket']['checkout']['shipping_name']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Stra?e', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['shipping_strasse']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Ort', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['shipping_plz']; ?> <?php echo $this->view['basket']['checkout']['shipping_ort']; ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Land', 'wpsg').':', 35); ?></span><?php echo $this->db->fetchOne("SELECT <code>name</code> FROM <code>".WPSG_TBL_LAND."</code> WHERE <code>id</code> = '".wpsg_q($this->view['basket']['checkout']['shipping_land'])."' "); ?> <?php } else { ?> <b><?php echo __('Rechnungs- /Lieferadresse:', 'wpsg'); ?> </b> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Firma', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['firma']; ?><br style="display:none;"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Name', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['vname']; ?> <?php echo $this->view['basket']['checkout']['name']; ?><br style="display:none;"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Stra?e', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['strasse']; ?><br style="display:none;"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Land', 'wpsg').':', 35); ?></span><?php echo $this->db->fetchOne("SELECT <code>name</code> FROM <code>".WPSG_TBL_LAND."</code> WHERE <code>id</code> = '".wpsg_q($this->view['basket']['checkout']['land'])."' "); ?><br style="display:none;"> <?php if (trim($this->view['basket']['checkout']['ustidnr']) != "") { ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('USt.IdNr.', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['ustidnr']; ?><br style="display:none;"> <?php } ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Ort', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['plz']; ?> <?php echo $this->view['basket']['checkout']['ort']; ?><br style="display:none"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Telefon', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['tel']; ?><br style="display:none"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Fax', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['fax']; ?><br style="display:none"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('E-Mail Adresse', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['email']; ?><br style="display:none"> <?php } ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Kundennummer', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['knr']; ?> <br style="display:none"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Bestellnummer', 'wpsg').':', 35); ?></span><?php echo $this->view['basket']['checkout']['onr']; ?> <br style="display:none"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Bestelldatum', 'wpsg').':', 35); ?></span><?php echo date("d.m.Y H:i:s", $this->view['basket']['checkout']['datum']); ?> <br style="display:none"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Rechnungbetrag', 'wpsg').':', 35); ?></span><?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')); ?> <br style="display:none"> <?php if ($this->get_option('wpsg_kleinunternehmer')) { ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo $this->get_option('wpsg_kleinunternehmer_text'); ?></span><br style="display:none"> <?php } else { ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Steueranteil', 'wpsg').':', 35); ?></span><?php echo wpsg_ff($this->view['basket']['sum']['mwst'], $this->get_option('wpsg_currency')); ?><br style="display:none"> <?php } ?> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Versandart', 'wpsg').':', 35); ?></span><?php echo $this->arShipping[$this->view['basket']['checkout']['shipping']]['name']; ?> <?php $this->callMods('mail_kundenmail_shipping'); ?> <br style="display:none"> <span style="width:150px; display:inline-block; font-weight:bold"><?php echo wpsg_pad_right(__('Zahlungsart', 'wpsg').':', 35); ?></span><?php echo $this->arPayment[$this->view['basket']['checkout']['payment']]['name']; ?> <?php $this->callMods('mail_kundenmail_payment'); ?> <?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { $prod_col = 25; } else { $prod_col = 35; } ?> <b><?php echo __('Bestellung', 'wpsg'); ?>:</b> <div style="width:510px; padding:8px; border:1px solid #ccc; background-color:#eee; border-radius:5px;font-size:12px;"> <span style="width:40px; text-align:left; display:inline-block;border-bottom:1px solid #000;"><?php echo wpsg_pad_right(__('Pos', 'wpsg'), 5); ?></span><span style="border-bottom:1px solid #000;text-align:left;width:260px;display:inline-block"><?php echo wpsg_pad_right(__('Produkt', 'wpsg'), $prod_col); ?></span><span style="width:70px;border-bottom:1px solid #000;text-align:right;display:inline-block; "><?php echo wpsg_pad_left(__('Stückpreis', 'wpsg').' ', 15); ?></span><?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?><span style="width:40px; display:inline-block; border-bottom:1px solid #000;"><?php echo wpsg_pad_left(__('MwSt.', 'wpsg').' ', 10); ?></span><?php } ?><span style="width:60px; display:inline-block; border-bottom:1px solid #000;text-align:right;"><?php echo wpsg_pad_right(__('Anzahl', 'wpsg'), 6); ?></span><span style="width:70px; display:inline-block; border-bottom:1px solid #000;text-align:right;"><?php echo wpsg_pad_left(__('Summe', 'wpsg'), 15); ?></span><br > <span><b style="display:none;">----------------------------------------------------------------------------</b></span><br style="display:none"> <?php $i = 0; foreach ((array)$this->view['basket']['produkte'] as $p) { $i ++; ?> <span style="width:40px; text-align:left; display:inline-block;"><?php echo wpsg_pad_right($i.'.', 5); ?></span><span style="text-align:left;width:260px;display:inline-block"><?php echo wpsg_pad_right($p['name'], $prod_col); ?></span><span style="width:70px;text-align:right;display:inline-block; "><?php echo wpsg_pad_left(wpsg_ff($p['preis'], $this->get_option('wpsg_currency')).' ', 15); ?></span><?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?><span style="padding-left:10px"><?php echo wpsg_pad_left(wpsg_ff($p['mwst_value'], '%').' ', 10); ?></span><?php } ?><span style="width:60px; display:inline-block; text-align:right;"><?php echo wpsg_pad_left($p['menge'], 6); ?></span><span style="width:70px; display:inline-block; text-align:right;"><?php echo wpsg_pad_left(wpsg_ff($p['preis'] * $p['menge'], $this->get_option('wpsg_currency')), 15); ?></span> <br style="display:none"> <span style="width:40px; text-align:left; display:inline-block;"></span><span style="font-size:10px;"><?php echo wpsg_pad_left(__('Art. Nr.:', 'wpsg').' ', 15); ?><?php echo wpsg_pad_right($p['anr'], ($prod_col - strlen($p['anr']))); ?></span> <br style="display:none"> <span style="width:40px; text-align:left; display:inline-block;"></span><span style="font-size:10px;"><?php $this->callMods('mail_kundenmail_row', array($i, $p)); ?></span><br style="display:none"><?php } ?> <?php if (isset($this->view['basket']['gs'])) { ?> <?php echo wpsg_pad_right(($i + 1).'.', 5); ?> <?php echo wpsg_pad_right(wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $this->view['basket']['gs']['code']), $prod_col); ?> <?php echo wpsg_pad_left(wpsg_ff($this->view['basket']['gs']['value'], (($this->view['basket']['gs']['calc'] == 'w')?$this->get_option('wpsg_currency'):'%')).' ', 15); ?> <?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?> <?php echo wpsg_pad_left(__('anteilig', 'wpsg').' ', 10); ?> <?php } ?> <?php echo wpsg_pad_left('1', 6); ?> <?php echo wpsg_pad_left(wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')), 15); ?> <?php } ?> <span style="width:40px; text-align:left; display:inline-block;"><?php echo wpsg_pad_left(' ', 5); ?></span><span style="text-align:left; padding-top:20px; width:390px; display:inline-block;"><?php echo wpsg_pad_right(__('Zwischensumme:', 'wpsg'), 40); ?></span><span style="padding-top:20px; text-align:right;width:70px; display:inline-block;"><?php echo wpsg_pad_left(wpsg_ff($this->view['basket']['sum']['preis'], $this->get_option('wpsg_currency')), 31); ?></span><br style="display:none"> <?php if ($this->view['basket']['sum']['preis_shipping'] != 0 || $this->get_option('wpsg_hideemptyshipping') != '1') { ?> <span style="width:40px; text-align:left; display:inline-block;"><?php echo wpsg_pad_left(' ', 5); ?></span><span style="text-align:left; width:390px; display:inline-block;"><?php echo wpsg_pad_right(__('Versandkosten', 'wpsg'), 50); ?></span><?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?> <?php echo wpsg_pad_left(wpsg_ff($this->arShipping[$this->view['basket']['checkout']['shipping']]['mwst_value'], '% '), 10); ?><?php } else { ?><?php } ?><span style="text-align:right;width:70px; display:inline-block;"><?php echo wpsg_pad_left(wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 21); ?></span><br style="display:none"><?php } ?> <?php if ($this->view['basket']['sum']['preis_payment'] != 0 || $this->get_option('wpsg_hideemptypayment') != '1') { ?> <span style="width:40px; text-align:left; display:inline-block;"><?php echo wpsg_pad_left(' ', 5); ?></span><span style="text-align:left; width:390px; display:inline-block;"><?php echo wpsg_pad_right(__('Zahlungsart', 'wpsg'), 50);?></span><?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?><?php echo wpsg_pad_left(wpsg_ff($this->arPayment[$this->view['basket']['checkout']['payment']]['mwst_value'], '% '), 10); ?><?php } else { ?><?php } ?><span style="text-align:right;width:70px; display:inline-block;"><?php echo wpsg_pad_left(wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 21); ?></span><?php } ?><br style="display:none"> <?php if (isset($this->view['basket']['sum']['preis_rabatt']) && $this->view['basket']['sum']['preis_rabatt'] > 0) { ?><?php echo wpsg_pad_right(__('Abzüglich Rabatt', 'wpsg'), 40); ?><?php echo wpsg_pad_left(wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 31); ?> <?php } ?> <?php if ($this->get_option('wpsg_kleinunternehmer') == '1') { ?> <?php echo $this->get_option('wpsg_kleinunternehmer_text'); ?> <?php } else { ?> <?php foreach ($this->view['basket']['mwst'] as $mwst_id => $mwst) { ?> <?php if ($this->get_option('wpsg_preisangaben_frontend') == WPSG_NETTO) { ?> <?php echo wpsg_pad_right(wpsg_translate(__('zuzüglich MwSt. (#1#)', 'wpsg'), $mwst['name']), 47); ?> <?php } else { ?> <span style="width:40px; text-align:left; display:inline-block;padding-top:20px;"><?php echo wpsg_pad_left(' ', 5); ?></span><span style="text-align:left; padding-top:20px; width:390px; display:inline-block;"><?php echo wpsg_pad_right(wpsg_translate(__('darin enthaltene MwSt. (#1#)', 'wpsg'), $mwst['name']), 47); ?></span><?php } ?><?php } ?><span style="padding-top:20px; text-align:right;width:70px; display:inline-block;"><?php echo wpsg_pad_left(wpsg_ff($mwst['sum'], $this->get_option('wpsg_currency')), 24); ?></span><br style="display:none"> <?php } ?> <b style="display:none"><?php echo wpsg_pad_left(' ', 61); ?>---------------</b><br style="display:none"> <span style="width:40px; text-align:left; display:inline-block; padding-top:20px;"><?php echo wpsg_pad_left(' ', 5); ?></span><span style="text-align:left; width:390px; display:inline-block;"><?php echo wpsg_pad_right(__('Gesamtpreis', 'wpsg'), 37); ?></span><span style="padding-top:20px;border-top:1px solid #000; text-align:right;width:70px;display:inline-block;"><?php echo wpsg_pad_left(wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 34); ?></span><br style="display:none"> </div> <?php $this->callMods('kundenmail_aftercalculation', array(&$this->view['basket']['checkout']['o_id'])); ?> <?php if ($this->view['basket']['checkout']['comment'] != '') { ?><b><?php echo __('Bestellkommentar', 'wpsg') ?>: </b><?php echo $this->view['basket']['checkout']['comment'] ?> <?php } ?> <b><?php echo __('Wir bedanken uns für Ihre Bestellung.', 'wpsg'); ?></b> <?php echo __('Bitte beachten Sie, dass es sich bei dieser E-Mail um eine Bestellbestaetigung und keine bindende Auftragsbestaetigung handelt. Preisirrtuemer sind leider nicht vollstaendig auszuschliessen.', 'wpsg'); ?><br style="display:none"> <?php echo __('Es gelten unsere Allgemeinen Gesch?ftsbedingungen (AGB).', 'wpsg'); ?><br style="display:none"> <?php echo $this->getURL(wpsg_ShopController::URL_AGB); ?> <?php $this->CallMods('kundenmail_afteragb', array(&$this->view['basket']['checkout']['o_id'])); ?> <b>-- <?php echo __("Widerrufsbelehrung", "wpsg"); ?> --</b> <?php if (trim($this->get_option("wpsg_ps_mailwiderruf")) != "") { ?> <?php echo $this->get_option("wpsg_ps_mailwiderruf"); ?> <?php } else { ?> <?php echo __("...hier steht der Text zum Widerrufsrecht...", "wpsg"); ?> <?php } ?> <b>-- <?php echo __("Ende der Widerrufsbelehrung", "wpsg"); ?> --</b><br style="display:none"> <?php echo __('Mit freundlichen Grü?en', 'wpsg'); ?> <b><?php echo __('Ihr Shop Team', 'wpsg'); ?></b>
As you see: quite a lot of html-tags.
Thank you for considering to take the changes into the plugin.I love your plugin! But I found this to be an issue for me as well. I had to custom format my emails to meet some client requirements but that HTML was ending up in my plain text emails and getting flagged as spam. I needed HTML tags to be stripped from my plain text emails. I’m going do what I hate to do.. manually alter the plugin. But I hope you can add this feature to your awesome plugin in a future version.
Thanks!
Dave
Sorry, I forgot that topic in the last update. I’ll add it to the next release.
- The topic ‘HTML Tags in %content% now possible’ is closed to new replies.