# Unable to send HTML email: PHP Warning

**URL:** <https://forum.mautic.org/t/unable-to-send-html-email-php-warning/3448>\
**Category:** Product Support\
**Created:** [February 12, 2016, 7:10pm UTC](https://forum.mautic.org/t/unable-to-send-html-email-php-warning/3448 "2016-02-12T19:10:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DJ\_Otter](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@DJ\_Otter](https://forum.mautic.org/u/DJ_Otter)\
**Post date:** [February 12, 2016, 7:10pm UTC](https://forum.mautic.org/t/unable-to-send-html-email-php-warning/3448/1 "2016-02-12T19:10:11Z")

</div>

Hi there. New to mautic. Trying to send a custom css/html email created in-house and get the below, copied via the log. FYI, the email displays fine in the public preview URL.  
  
  
  
[2016-02-12 17:56:07] mautic.WARNING: PHP Warning: Invalid argument supplied for foreach() - in file /opt/bitnami/apps/mautic/htdocs/app/bundles/CoreBundle/Templating/Helper/FormatterHelper.php - at line 56 []  
  
  
  
Thank you for any assistance.  
  
  
  
Best, DJ.

---

<div class="post-metadata">

**Author:** ![DJ\_Otter](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@DJ\_Otter](https://forum.mautic.org/u/DJ_Otter)\
**Post date:** [February 12, 2016, 7:10pm UTC](https://forum.mautic.org/t/unable-to-send-html-email-php-warning/3448/2 "2016-02-12T19:10:11Z")

</div>

Hi there. New to mautic. Trying to send a custom css/html email created in-house and get the below, copied via the log. FYI, the email displays fine in the public preview URL.

[2016-02-12 17:56:07] mautic.WARNING: PHP Warning: Invalid argument supplied for foreach() - in file /opt/bitnami/apps/mautic/htdocs/app/bundles/CoreBundle/Templating/Helper/FormatterHelper.php - at line 56 []

Thank you for any assistance.

Best, DJ.

---

<div class="post-metadata">

**Author:** ![DJ\_Otter](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@DJ\_Otter](https://forum.mautic.org/u/DJ_Otter)\
**Post date:** [February 16, 2016, 8:48pm UTC](https://forum.mautic.org/t/unable-to-send-html-email-php-warning/3448/3 "2016-02-16T20:48:30Z")

</div>

Thanks for the reply.

We already have a custom html/css mailer we send via our former mail provider - mail chimp. The template is a single file with css in header and inline css within the html table structure. Steps to reproduce:

1. In Email we created a new template for list? and selected “none” template.
2. We pasted the entire CSS/HTML in line into the source block of the WYSIWYG.
3. The WYSIWYG preview looked good, so we uploaded a sample list and scheduled the email to send to the sample list.
4. We manually ran the cron jobs to update the campaign and send the email to the sample (test) list.
5. When the job kicked off and tried to send the email through our SMTP server, we got these errors in mautic.

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [February 17, 2016, 12:07pm UTC](https://forum.mautic.org/t/unable-to-send-html-email-php-warning/3448/4 "2016-02-17T12:07:53Z")

</div>

I looked at the code. The problematic line is here:

[https://github.com/mautic/mautic/blob/staging/app/bundles/CoreBundle/Templating/Helper/FormatterHelper.php#L56](https://github.com/mautic/mautic/blob/staging/app/bundles/CoreBundle/Templating/Helper/FormatterHelper.php#L56)

This FormatterHelper is used (if I didn’t overlooked anything) only in the Report Bundle. Not in the Email Bundle. I also cannot reproduce it anyhow. Could you test if it happens with another, simpler email? Maybe it’s caused by the email content and in that case, we’ll need it to fix it.

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [February 15, 2016, 9:36am UTC](https://forum.mautic.org/t/unable-to-send-html-email-php-warning/3448/5 "2016-02-15T09:36:32Z")

</div>

Could you provide the steps to replicate this warning?
