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?
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.
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&hl=en
Thanks and good luck...
EDIT: Whoa... this is an oldie question ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With