Mautic 2.16.1 Campaign email error value has type 'number' when expecting type 'string'

Your software
My Mautic version is: 2.16.1
My PHP version is: 7.1 (also tried on 7.3)

Your problem
My problem is: After upgrading from 2.15 to 2.16.1…emails being sent in Campaign do not execute. They have the error:
Last execution error: content.headers json dictionary value has type ‘number’ when expecting type 'string’

These errors are showing in the log:
mautic.ERROR: [MAIL ERROR] content.headers json dictionary value has type ‘number’ when expecting type ‘string’ Log data: !! content.headers json dictionary value has type ‘number’ when expecting type ‘string’ (code: 0) (send); EMAILVALUE, EMAILVALUE {“exception”:"[object] (Swift_TransportException(code: 0): content.headers json dictionary value has type ‘number’ when expecting type ‘string’\nLog data:\n!! content.headers json dictionary value has type ‘number’ when expecting type ‘string’ (code: 0) at /home/public_html/mautic/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php:140)"}

Steps I have tried to fix the problem: Update Schema, changed PHP versions, Clear Cache. Tried going into the campaign and resaviing it. Attempted to update Email in campaign as well. Same error. Note, I do not have access ot SSH, all attempts are manual for schema and cache clear.

I did a complete new install except for the database. Deleted all files, uploaded 2.16.2, and then set up and did schema update…but still, same error with headers. Is this a bug? or is this a server issues? or is this a database issue? Any guidance into where to dig further would be appreciated. Im surprised no one else is having this issue.

@versadial
Thanks for providing this log entry and for doing the new installation.

My wild guess is that one of your emails has some content in it that is somehow not compatible with the new Mautic version, but that’s a very rough indication so please take it with a grain of salt. Just trying to understand what exactly is going wrong.

To help us better understand the issue, could you please:

  1. Create a new email from scratch to see if you’re experiencing the same issue when sending that email?
  2. What is your email provider (PHP Mail/Sendgrid/etc.)? Another user seems to have the same issue and is using Sparkpost: https://github.com/mautic/mautic/issues/8621

I’m also facing the same issue, actually i thought the same i removed all the emails and created new it did’t work and then i updated from fresh install of 2.15.3 to 2.16.2 and having same problem.

It is happening with sparpost and gmail smtp server.

mautic.ERROR: [MAIL ERROR] content.headers json dictionary value has type 'number' when expecting type 'string' Log data: !! content.headers json dictionary value has type 'number' when expecting type 'string' (code: 0) (send); myemail@domain.com {"exception":"[object] (Swift_TransportException(code: 0): content.headers json dictionary value has type 'number' when expecting type 'string'\nLog data:\n!! content.headers json dictionary value has type 'number' when expecting type 'string' (code: 0) at /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php:140)"} []

Thanks.

Bingo!

It’s sparkpost, I too have sparkpost. Wow, I would not have even considered that, as the error I have seen people complain is in regards to connecting to their external email source.

So confirmed, it is sparkpost related.

I tested with PHP email, and all worked. Similar to the github post, the Test email goes through fine, but the Campaign emails are the ones that have the issue.

Is this something Sparkpost developers should look into, or is it still related to mautic developers needing to patch how they communicate with sparkpost?

Thank you!

Did you try PHP mail? Perhaps, not only Sparkpost, but also other third party email such as Gmail too.

I am interested to find out if someone has a solution for this. I have recently considered moving over my clients to SparkPost, and had an amazing talk with their sales rep. I am excited to move over, but when I went ahead and tested I got the same errors.
Changed system back to SendGrid and mailers went out no problem

Hi folks, Just following up that this was fixed with this PR in Mautic 3.0.