MMS with HTML markup

Publication date: 2020-01-01
Last update: 2020-01-01
Author: Victor Celer

 

Let's explain how to generate a multimedia message (MMS) including hypertext markup (HTML), for example:

MMS with HTML

The MMS file used in the previous screenshot is available here. Note that a mobile phone doesn't usually support opening an MMS file directly. It's necessary to actually send the file through the operator Multimedia Messaging Service Centre (the MMSC) for the messaging application on the phone to interpret the file as a valid MMS and display it.

 

Technical background

The MMS specifications are available to public domain at the Open Mobile Alliance (OMA). According to the specifications, the layout of the MMS message is defined using SMIL formatting. We are not referring to the latest SMIL V3 specification on purpose because it is not supported in MMS. Only a limited set of SMIL features, covered by the original specification, are supported by most MMS clients. According to Ericsson, the SMIL formatting was supposed to evolve until matching the capabilities of HTML markup.

It's important to highlight that none of the standards mention that an MMS client must support HTML. Moreover, if an MMS client does support HTML, it doesn't necessarily support all hypertext features, like dynamic scripts, style sheets, interactive forms and so on. In fact, a very limited set of HTML features is supported by most MMS clients.

 

HTML tags supported

A basic subset of HTML tags and attributes is supported by most MMS clients, including the Android Messages app:

  • <a> (supports attribute "href")
  • <b>
  • <big>
  • <blockquote>
  • <br>
  • <cite>
  • <dfn>
  • <div>
  • <em>
  • <font> (supports attributes "color" and "face")
  • <i>
  • <img>
  • <p>
  • <small>
  • <strong>
  • <sub>
  • <sup>
  • <tt>
  • <u>

Other tags are automatically removed. So, it's not possible to include JavaScript, CSS, forms and other advanced HTML features.

Make sure that the "href" attribute contains a valid schema prefix ("http://" or "mailto:"). If no schema is specified the MMS client may crash. This bug was observed in Android Messages.

Even though the <img> tag is supported it is not possible to include an image. Some graphical container might get drawn, which means that the MMS client understands this tag, but there is no way to make it load an image file. So, one can include pictograms thanks to Unicode, but no real images. In the sample MMS file we used the U+2708 Unicode character presenting an airplane ✈.

The HTML markup in MMS is generally supported in iOS and a subset of Android devices:

Android Android Only the AOSP version of the Messages app, since Android 5. The current Google Messages RCS-capable app doesn't support MMS with HTML. Therefore it's possible to assume that Google is dropping the support for HTML in MMS.
 

Note: The AOSP version is preinstalled in most low- and medium-end Android devices. High-end devices may feature an OEM-specific app instead of AOSP. For example, Huawei has it's own app.

iOS iOS Since iOS 3

 

Sample

The following HTML code simulates a boarding ticket notification. It is saved in a file named h.htm:

<big><font color="#da291c">MyAirline</font> XY00</big><br>
<tt><b>BOG</b><font color="#da291c">•✈</font><font color="#c0c0c0">‧‧‧‧‧‧‧‧•</font><b>MEX</b></tt>
<br><br>
<a href="http://www.myairline.com/check-in">Check-In</a>

This is how it looks like in a web browser:

MyAirline XY00
BOG• ✈ ‧ ‧ ‧ ‧ ‧ ‧ ‧ ‧ •MEX

Check-In

 

This is how we can include our HTML file h.htm inside the SMIL layout:

<smil>
   <head>
      <layout>
         <root-layout/>
         <region id="Text" width="100%" height="100%"/>
      </layout>
   </head>
   <body>
      <par dur="60s">
         <text src="h.htm" region="Text"/>
      </par>
   </body>
</smil>

Notice that the HTML file doesn't replace the SMIL layout, it is embedded inside SMIL.