Outlook: Ultimate insert images into signature that you can safely send
Outlook has a tendency to either not send embedded images with signatures, or it sends links to images (like in OWA) The solution is to convert the image to Base64 string, and use it like that
- Embedding base64 image string into html
<img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />
Now, You can either use an online converter such as this one, or you can start coding yourself:
- c# converter
// convert from bitmap to byte array public byte[] getBytesFromBitmap(Bitmap bitmap) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.JPEG, 70, stream); return stream.toByteArray(); } // get the base 64 string String imgString = Base64.encodeToString(getBytesFromBitmap(someImg), Base64.NO_WRAP);
The imgString value is what you want to send Other examples:
- css
div.image { width:100px; height:100px; background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...); }
- xml
<image> <title>An Image</title> <link>http://www.your.domain</link> <url>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...</url> </image>