embedding image in html email

Try to insert it directly, this way you can insert multiple images at various locations in the email. <img src=”data:image/jpg;base64,{{base64-data-string here}}” /> And to make this post usefully for others to: If you don’t have a base64-data string, create one easily at: http://www.motobit.com/util/base64-decoder-encoder.asp from a image file. Email source code looks something like this, but … Read more

Proper MIME type for OTF fonts

There are a number of font formats that one can set MIME types for, on both Apache and IIS servers. I’ve traditionally had luck with the following: svg as “image/svg+xml” (W3C: August 2011) ttf as “application/x-font-ttf” (IANA: March 2013) or “application/x-font-truetype” otf as “application/x-font-opentype” (IANA: March 2013) woff as “application/font-woff” (IANA: January 2013) woff2 as … Read more

Proper MIME media type for PDF files

The standard Media Type (formerly known as MIME types) is application/pdf. The assignment is defined in RFC 3778, The application/pdf Media Type, referenced from the Media Types registry. Media Types are controlled by a standards body, The Internet Assigned Numbers Authority (IANA). This is the same organization that manages the root name servers and the … Read more

How to find the mime type of a file in python?

The python-magic method suggested by toivotuo is outdated. Python-magic’s current trunk is at Github and based on the readme there, finding the MIME-type, is done like this. # For MIME types import magic mime = magic.Magic(mime=True) mime.from_file(“testdata/test.pdf”) # ‘application/pdf’

Using .NET, how can you find the mime type of a file based on the file signature not the extension

I did use urlmon.dll in the end. I thought there would be an easier way but this works. I include the code to help anyone else and allow me to find it again if I need it. using System.Runtime.InteropServices; … [DllImport(@”urlmon.dll”, CharSet = CharSet.Auto)] private extern static System.UInt32 FindMimeFromData( System.UInt32 pBC, [MarshalAs(UnmanagedType.LPStr)] System.String pwzUrl, [MarshalAs(UnmanagedType.LPArray)] … Read more