Incomplete chunked encoding

Posted on April 19, 2016


There’s a form using php mail() to send HTML message. After clicking submit, variety of things will happen on server side, including email sending to submitter, to company and to me as a developer. For customer, it appears that nothing happens after click. However, all actions are performed just fine.

While Firefox is not giving any kind of error, in Chrome debugger I got this: ERR_INCOMPLETE_CHUNKED_ENCODING. Not very informative and it looks like there is a lot of reasons for this to happen. Oftentimes, this is not an issue, but when it takes place after client clicks submit and it looks like nothing happens, it needs to be addressed.

For me the reason was in php mail() headers. When adding an email to Cc or Bcc that is not having an MX entry on same server, submit seems to freeze and ERR_INCOMPLETE_CHUNKED_ENCODING appears. However, emails will be delivered just fine.

I don’t know the reason for this, but I suspect it is some kind of reverse checking where php mail() didn’t got an answer from email server outside it’s own environment. This error appeared on code that had been untouched for a good time, so it must have started with some server update. Perhaps someone could point a correct server configuration to fix this.