Receiving MMS Messages Is More Reliable Now – April 06, 2022

After a long time of not being able to figure out why some MMS messages don't come through well, and others are fine, I finally figured it out.

PHP's mail() function doesn't do anything with line-wrapping and some email clients and servers have trouble with long lines.  The RFC standard is 80 characters (78 plus the carriage return/line feed), and Amazon (which is where the MMS images get hosted temporarily) uses really long lines in their URLs - over 1,000 characters, so I suppose it is reasonable that mail servers don't like emails that go past the standard by 12X.  There was an extra space being added for the 998th character, which was breaking the URL into two pieces and causing the image to give a strange licensing/login error, which when I asked the upstream provider, they said I wasn't downloading the image soon enough, which seemed pretty strange, but I finally figured it out, because today I tried to download an MMS message seconds after receiving it, and it still didn't work.

So, I'm happy to report that the images work for a much longer period of time (I'll have to test it to see if it is back to 24 hours or more, which it used to be), or if I should still be downloading them locally right away and then storing them for your retrieval later.

In any case, the images should be working more reliably now.