views:

468

answers:

3

I have an application that sends an HTML formatted email with embedded images. The email looks perfect on many different desktop/web clients. When the email is viewed on a mobile phone that supports HTML email (tested on iPhone, WinMo 6.1) the images are displayed as red 'X's. All other HTML is being displayed correctly. To be clear, the problem is ONLY occurring on mobile clients and not on desktop clients.

The code to embed images is working perfectly and I don't believe there is any problem with it but I've included some quick sample code below just in case:

MailMessage mail = new MailMessage();
            mail.To.Add("[email protected]");
            mail.From = new MailAddress("456@ myemail.com");
            mail.Subject = "Image sample - fails in mobile clients";
            string Body = "Sample email text<img src=\"cid:imageId\" />";

            AlternateView htmlView = AlternateView.CreateAlternateViewFromString(Body, null, "text/html");
            LinkedResource lr = new LinkedResource("myImage.jpg");
            lr.ContentId = "imageId";
            htmlView.LinkedResources.Add(lr);

            mail.AlternateViews.Add(htmlView);
            SmtpClient smtpClient = new SmtpClient();
            smtpClient.Send(mail);

Does anyone know why embedded images are not displayed on mobile clients? Better yet, how can I get the images to display correctly?

Edit: If Outlook 2007 (and above) sends an email with images then the images are displayed correctly in a mobile client and desktop client. If an HTML formatted email is sent with embedded images then the images are not displayed correctly in the mobile client but are correctly displayed in a desktop client.

How is Outlook able to send emails with images confidently displayed but if sent through a web app (using embedded images) the mobile client blocks the images. What is the difference between the two?

A: 

Most often the cause is the settings on the smart phone being set to prevent the downloading of email images by default. On most phones, the default behavior is that they have to download the images manually, usually by a button or setting in the email client, if they want to see the images attached to that particular email. It's the same setting I use in my desktop and laptop Outlook settings as well. For most email clients, it's a spam protection thing. For the phones, it's also to save bandwidth from unnecessary usage. You should never count on the clients always seeing the images by default.

BBlake
No, that's not the case for embedded images. The images arrive at the client with the images already attached. Users will not be requested by their clients to download the images. That's one of the benefits of embedding. Everything works beautifully and just how you would want it to and spam protection doesn't come into play.
Alison
+1  A: 

This is as other users said, a preferences issue and a known bug.

Alison, are you positive that the image binaries made their way to the phone? As other users stated, the preferences issue might be a default to cut down on the inadvertent download of bulky images to mobile clients with limited data plans.

As for the known issue, please see

http://www.google.com/support/forum/p/Google+Mobile/thread?tid=6470e77d94f0315c&amp;hl=en

Thanks and good luck...

EDIT: Whoa... this is an oldie question ;)

rob - not a robber
+1  A: 

I finally found an answer to this problem: The optional ContentType of the LinkedResource was not set. Desktop clients can figure out

From MSDN:

The information in the ContentType class is used to describe the data contained in an e-mail message in such a way that software that displays e-mail can present the content in an appropriate manner. ContentType is used with the Attachment class to specify the type of content in the attachment.

Outlook was able to understand how the attached image was to be displayed but the mobile clients required more information.

Alison