Support

Home Forums Event Espresso Premium EE emails – Spaces between header and content

EE emails – Spaces between header and content

Posted: May 22, 2018 at 10:43 am


AviramL

May 22, 2018 at 10:43 am

Hi
I checked everywhere but I just can’t figure out the solution.
When sending EE emails, I have a bunch of empty lines before the header and the main content of my email.
I checked in WP Setting > Email Template and I have no empty lines in the header.
I checked in EE Emails > Main Content and I only have text, nothing above.

How and where can I fix this? Thanks !


AviramL

May 22, 2018 at 10:44 am

Sorry I meant between the header and the main content


Josh

  • Support Staff

May 22, 2018 at 1:52 pm

Hi there,

We can look into this. May I ask can you post a screenshot that includes the extra space? Also, can you send the contents of the Main Content section of the email template (from the Text view)?


AviramL

May 22, 2018 at 2:06 pm

Thanks Josh. Sure here it is:

Le message suivant a été envoyé à la personne ayant effectué l’inscription :

<h3>Détail des règlements :</h3>
<ul>
 	<li style="list-style-type: none;">
<ul>
 	<li><strong>Etat du règlement :</strong> [PAYMENT_STATUS]</li>
 	<li><strong>ID de la transaction : </strong>[TXN_ID]</li>
 	<li><strong>Passerelle de règlement:</strong> [PAYMENT_GATEWAY]</li>
 	<li><strong>Coût total : </strong> [TOTAL_COST]</li>
 	<li><strong>Montant de la transaction : </strong> [AMOUNT_PAID]</li>
 	<li><strong>Montant du: </strong> [TOTAL_OWING]</li>
 	<li><strong>Facture:</strong> [INVOICE_LINK]</li>
</ul>
</li>
</ul>
<h2></h2>
<h2>Détails de la personne inscrite:</h2>
<p class="callout"><strong>[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]:</strong>
[PRIMARY_REGISTRANT_EMAIL]</p>

And screenshot : https://imageshack.com/a/img923/3350/iADUxK.jpg


AviramL

May 22, 2018 at 2:09 pm

Code will be easier to read : https://pastecode.xyz/view/768546af


AviramL

May 22, 2018 at 2:09 pm

Code will be easier to read: https://pastecode.xyz/view/768546af


AviramL

May 22, 2018 at 2:10 pm

Code will be easier to read:
Le message suivant a été envoyé à la personne ayant effectué l’inscription :
<h3>Détail des règlements :</h3>

    <li style=”list-style-type: none;”>
  • Etat du règlement : [PAYMENT_STATUS]
  • ID de la transaction : [TXN_ID]
  • Passerelle de règlement: [PAYMENT_GATEWAY]
  • Coût total : [TOTAL_COST]
  • Montant de la transaction : [AMOUNT_PAID]
  • Montant du: [TOTAL_OWING]
  • Facture: [INVOICE_LINK]

<h2></h2>
<h2>Détails de la personne inscrite:</h2>
<p class=”callout”>[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]:
[PRIMARY_REGISTRANT_EMAIL]</p>`
`


Josh

  • Support Staff

May 23, 2018 at 7:20 am

Is the logo at the top getting added by means of a custom stylesheet or a custom header template?


AviramL

May 23, 2018 at 8:22 am

Hi !
No this is just using the settings in Settings > Email Template > Header (wp-admin/options-general.php?page=wp-html-mail&tab=header)


Josh

  • Support Staff

May 23, 2018 at 8:44 am

Oh that’s from a different plugin. The space is probably being added by the other plugin. That’s this one, https://wordpress.org/plugins/wp-html-mail/, right?


Josh

  • Support Staff

May 23, 2018 at 8:48 am

Or are you using this plugin?

https://wordpress.org/plugins/email-templates/


AviramL

May 23, 2018 at 9:05 am

I think you are right, this is the first one.
I actually replaced this plugin with the second and I still have the spaces for EE messages.
What would you recommend ?


Josh

  • Support Staff

May 23, 2018 at 10:00 am

If you have the second one activated, then adding this code should remove its effect on the EE emails:

https://gist.github.com/joshfeck/12910a43ef450e2c3316176b08c25868

You can add the above to a functions plugin.


AviramL

May 23, 2018 at 11:05 am

Thanks Josh
So I understand this fix removed the template completely.
What would be the solution to keep the header and display?


Josh

  • Support Staff

May 24, 2018 at 12:31 pm

This is a tricky one because the spaces between the header and the content are added by the other plugin.

One way to reduce most of the space would be to override Event Espresso’s main email template wrapper so that it only outputs the message content (nothing else) because the other email plugin adds its own html wrapper.

So the steps to make this happen are as follows:
1) set up a site specific plugin by following this guide:
https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/
2) Add this PHP code to your site specific plugin’s main file:

add_filter(
	'FHEE__EE_Messages_Template_Pack__get_wrapper', 
	'my_custom_email_wrapper_override', 
	10, 
	4
);
function my_custom_email_wrapper_override($template, $messenger, $type, $object) {
	if($messenger == 'email' && $type == 'main') {
		$template = plugin_dir_path( __FILE__ ) . 'email_main_wrapper.template.php';
	}
	return $template;
}

3) create a new file within the site specific plugin, and name it:
email_main_wrapper.template.php
4) add this code to the email_main_wrapper.template.php file:
<?php echo $main_body; ?>


AviramL

May 25, 2018 at 9:03 pm

Thanks Josh. A bit tricky but working, indeed.
However it seems I have some formatting issues now, any idea how to fix this?
formatting issue


Josh

  • Support Staff

May 26, 2018 at 10:45 am

If you deactivate the other email plugins does the formatting issue go away for new emails? Also, if you check the email preview from within the message templates editor, does it have any formatting issues?


AviramL

May 26, 2018 at 9:51 pm

Hi Josh
The other email plugin was deactivated and the email preview doesn’t have any formatting issue. They appear in the test email.


Josh

  • Support Staff

May 29, 2018 at 6:52 am

The formatting issue may be the result of yet another plugin conflict.

One way you can rule out a plugin or theme conflict is by installing the Health Check plugin, then go to WP → Dashboard → Heath Check → Troubleshooting. There you’ll Enable Troubleshooting Mode, then once that’s activated you’ll reactivate Event Espresso only via the Health Check’s Troubleshooting item in the WP admin bar. At that point, can you check to see if the issue persists?

The support post ‘EE emails – Spaces between header and content’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso