问题
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