Cannot embed inline image in outlook when image is in barcode

你。 提交于 2019-12-13 05:59:06

问题


I have created one barcode image and convert it in data stream and embed it inline and pass it through smtp mail. Now recipient can able to see that barcode in webmail, but cannot able to see it outlook it is coming as red cross (x). Any help is highly appreciated.

private string MyMethod(string myInputStr) 
{
       var myBarcodeObj = new Barcode(); 
       string myString = string.Format("{0}\t", myInputStr); 
       byte[] myGeneratedCode = myBarcodeObj.GenerateCode(myString); 
       string myBase64ImageString = ConvertBytesToBase64(myGeneratedCode ); 
       objBEorder.ERPOrder.ImgBarcode = new System.Web.UI.WebControls.Image() 
      { 
       ImageUrl = "data:image/jpg;base64," + myBase64ImageString 
      };
}
private string ConvertBytesToBase64(byte[] imageBytes) 
        { 
            return Convert.ToBase64String(imageBytes); 
        }

回答1:


HTML images are rendered by Word in Outlook, and it does not support embedded ("data:image/jpg;base64) images.

Add the image as an attachment and set its Content-ID MIME header. The HTML body should refer to the image thorugh the cid attribute (<img src="cid:xyz">)



来源:https://stackoverflow.com/questions/32368949/cannot-embed-inline-image-in-outlook-when-image-is-in-barcode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!