📜 ⬆️ ⬇️

OMF - microformat for email. Experience using chat services

image More recently, Mail.ru has developed an open standard, OMF.

Open Mail Format (OMF) is an open standard for marking email notifications. OMF allows you to improve the presentation of your letters in the Mail.Ru mail interface, increasing their efficiency and conversion.

I decided to try it in the email notifications of my chat widget service.
Mail.Ru now supports an expanded display of the list of letters, in which a picture, a short text of the letter and several links are shown for each letter:
To switch to the advanced mode in the mail interface, you need to use the "Details" button on the upper right of the list of letters.

After reading the specification OMF decided to try it in action. Integrated this microformat into email notifications to chat users.

The first thing that had to be done was to translate the letters sent from Plain text to HTML.
To maintain compatibility with email clients that do not understand the HTML letters, the Content-Type letters should be set to “multipart / alternative” and add 2 multipart blocks to the letters, the first with plain text (Content-Type: text / plain) and the second with HTML version (Content-Type: text / html).
Thus, modern mail services and programs will display the HTML version of the letter, and the older ones will display the old text one.

The second step was to directly attach the OMF to the letters.
For this, it was necessary to conclude the main content of the text of the letter in a DIV with the CSS class notification. And inside use vcard and special markup from Mail.ru.

As an example, I will cite the notice of “adding friends.”
Original text version of the letter:



(Admin) : http://demo.chatovod.ru/ "" "".

Translated into HTML and added OMF microformat:
Copy Source | Copy HTML<br/> <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br/> < html xmlns ="http://www.w3.org/1999/xhtml" xml:lang ="ru" lang ="ru"> <br/> < head > <br/> < title > </ title > <br/> < meta http-equiv ="Content-Type" content ="text/html; charset=UTF-8" /> <br/> </ head > <br/> < body > <br/> < div class ="friendship-request notification"> <br/> < h2 > ! </ h2 > <br/> < span class ="text"> < span class ="actor vcard">< img class ="photo attachment" align ="absmiddle" src ="http://st1.chatovod.ru/a/2010/01/07/117/1262865512135.jpg" /> < a class ="url fn" href ="http://demo.chatovod.ru/id117"> </ a ></ span > . </ span > <br/> < br />< br /> (Admin) < b >< a class ="action-link" href ="http://demo.chatovod.ru/"> http://demo.chatovod.ru/ </ a ></ b > "" "".<br/> </ div > <br/> </ body > <br/> </ html > <br/>

Now Mail.ru displays this letter in the list as follows:


Displays a fragment of the text of the letter, which was enclosed in a SPAN tag with the class text and also a link to the site, which was designated by the class action-link.
The letter icon remains the same, although it should be replaced by an image indicated by the photo class. Apparently this feature is still being tested by Mail.ru and is not included for everyone.

According to Mail.ru, the first senders who supported Open Mail Format will be the dating service Mamba, the resource Afisha.ru, the online recruitment site HeadHunter.ru and the online auction Molotok.ru.
I wonder how this format will become popular with other mail services? I, as a developer of popular sites, would like to introduce OMF by all participants of the postal market.

Additional Information:
Brief description of OMF: http://api.mail.ru/mail/omf/
Markup examples and specifications: http://www.openmailformat.org/examples.html

The article did not write about many things. I will answer your questions in the comments.

UPDATE. The problem with the pictures is solved. It was necessary to bring the class actor out of the class text. After correcting the pictures, the letters appeared.

Source: https://habr.com/ru/post/102184/

All Articles