Your latest adjustments to the template.php file for email is not compatible with mandril (mailchimp), elasticmail or sendgrid (all of which are dependent on Acymail) for email template overrides on joomla emails. The problem is your additional "Visually Hidden Preheader Text" which includes the extra (<?php echo $contents; ?>

.
In all of these email sending systems, your ES emails are now sending out emails with double the ES content message, because they are seeing (<?php echo $contents; ?>

twice in the ES email template... and they do not understand the "Visually Hidden Preheader" statement.