I came across a strange little problem reported in answers.microsoft.com with Windows Phone 8 Mail. It wasn’t downloading  jpg images.

The email app that comes with Windows Phone 8 does not display image attachments automatically. You need to tap on them and then they download and you can view them. That drives some people batty, but it saves on bandwidth and prevents web bugs from tracking you.

When you view an image in an email, you are providing a lot of information about yourself to the sender. First of all, you are telling the sender that your address is active.  Which can mean more spam.  For that reason Google is now sending all images coming in through GMail through a proxy server.

A user reported that he couldn’t download images from mail. When he tapped on them, just just displayed the “Downloading…” status message.  We traded a few messages and nothing sounded out of the ordinary. So I asked him to me an email with one of those images. And he did.  He sent a few images in an email.  To keep thing simple, I’ll just refer to a single image and call it “foo bar.jpg”. His image had a different file name, but this one matches the naming convention with out using his personal information.

I saw the same thing.  Tapped on the image and saw the “Downloading…” display without ever getting the image. So I started playing around his message.  I used a GMail account and I viewed the message from the GMail web app.  Sure enough, it displayed the image just fine.  That ruled out the image being corrupt.

I saved the image to my PC and looked it with a few apps.  Nothing out of the ordinary, just an image from a Kodak digital camera, according the EXIF data.

So I decided to poke around a bit. Using GMail, I sent the same picture to another gmail account that I have.  That worked just fine on my phone.  That was strange so I took another look at his email.  His email was sent from Windows Mail. So I sent the same picture to my gmail account from Windows Mail on Windows 8.1.

And I couldn’t open the picture from Windows Phone Mail.  I could create the problem on my end. That’s half the battle in fixing bugs, getting past “It works on my machine” stage.

Image from the Coding Horror

To completely rule his picture being part of the problem, I went into Paint.Net and created a small jpeg and saved it as “test.jpg”. I sent that picture from Windows Mail to the GMail account, and sure enough that worked just fine.

I thought I was going down the right path, but another data point was mocking me. Mocking me to my face. Time to dig in deeper.  I went into GMail and opened up the message that had “foo bar.jpg” in it and selected “Show original” to see the actual message being sent.  It looked pretty normal, until I got to the part with the image attachment.

Content-Type: image/jpeg; name="=?utf-8?Q?Foo_Bar.jpg?="
Content-Description: =?utf-8?Q?Foo_Bar.jpg?=
Content-Disposition: attachment; name="=?utf-8?Q?Foo_Bar.jpg?="
Content-Transfer-Encoding: base64

After that the data for the image itself was included.  The image data was fine, but the file name seemed a little odd. The =?utf-8?Q? bit just says that the file name is UTF-8 encoded. The name itself had replaced the space in “foo bar.jpg” with an underscore to make “foo_bar.jpg”.

When I sent the email from GMail, the content header block for the image looked like this

Content-Type: image/jpeg; name="Foo Bar.jpg"
Content-Disposition: attachment; filename="Foo Bar.jpg"
Content-Transfer-Encoding: base64

Gmail did not replace the ” ” with a “_”.  When you viewed the both emails on the phone, the file name was displayed with the space. I copied the image to foobar.jpg and sent it from Windows Mail, it worked perfectly.

As near as I can tell, the problem is with the Windows Phone Mail app, everything else seems to handle the images correctly. The question thread has been passed along to Microsoft to take a closer look at.

I’m not anticipating a quick fix from Microsoft.  But it’s easy to get around this.  Don’t send images with spaces in the file name from Windows Mail. Use a different email app or rename the file.