Reputation: 9866
I use Postmark for a contact form in a Ruby on Rails app. I'm getting the following error when attempting to send a message:
Postmark::InvalidMessageError
Received invalid JSON input
How can I fix this?
Upvotes: 0
Views: 595
Reputation: 9866
Turns out the cause of this was due to the utf8 hidden field that is automatically generated from Ruby on Rails form helpers. When I removed the following line from my form in Chrome's dev tools, it submits just fine:
<input name="utf8" type="hidden" value="✓">
Part of the reason this caused issues was due to the fact that I was including the full form params hash in the message for debugging purposes. I fixed it by including this in my mailer:
params.delete(:utf8)
Upvotes: 3