Hi Dirk-Jan Klinkhamer,
Thank you for your patience.
We have almost completed our investigation and would like to share with you that we have identified the reason for this problem. For embedded images to be displayed properly on iPhone, the
![]()
should refer to Content-ID instead of file name in the HtmlBody of the message. e.g.
img src=“image.001.jpeg” should be img src="cid:352b5d49-1427-45e3-acb7-57edf7db3f38"
Until the fixed version is available for this problem, you can try any of the following work around methods for proper display of embedded images on iPhone. Please try it at your end and let us know your feedback.
<span style=“font-size:9.5pt;font-family:“Arial”,“sans-serif”;
color:#2B91AF”>Method 1<o:p></o:p>
Document wordDocument
= new Document(@"testdoc.docx");
MemoryStream mhtmlStream = new MemoryStream();
wordDocument.Save(mhtmlStream, SaveFormat.Mhtml);
// Load the MHTML in MailMessage
mhtmlStream.Position = 0;
MailMessage message = MailMessage.Load(mhtmlStream, MessageFormat.Mht);
message.From = "from@gmail.com";
message.To = "to@aspose.com";
message.Subject = "Testing
Workaround method 1";
foreach (Aspose.Email.Mail.LinkedResource
linkedResource in message.LinkedResources)
{
linkedResource.ContentId = linkedResource.ContentLink.ToString();
}
message.HtmlBody = message.HtmlBody.Replace("<img src=\"", "<img src=\"cid:");
Method 2
// Invoice.doc contains embedded images
Document wordDocument = new Document("testdoc.docx");
MemoryStream mhtmlStream = new MemoryStream();
wordDocument.Save(mhtmlStream, SaveFormat.Mhtml);
// Load the MHTML in MailMessage
mhtmlStream.Position = 0;
MailMessage message = MailMessage.Load(mhtmlStream, MessageFormat.Mht);
message.From = "from@gmail.com";
message.To = "to@aspose.com";
message.Subject = "Testing
Workaround method 2";
foreach (Aspose.Email.Mail.LinkedResource
linkedResource in message.LinkedResources)
{
string oldStr = string.Format("<img src=\"{0}\"",
linkedResource.ContentLink);
string newStr = string.Format("<img src=\"cid:{0}\"",
linkedResource.ContentId);
message.HtmlBody = message.HtmlBody.Replace(oldStr, newStr);
}