diff --git a/include/class.format.php b/include/class.format.php
index 53ad259c6e29e27423e56bba772b70a184e1529f..b0aafa229b5430146889df00749d5754e3a50747 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -219,7 +219,7 @@ class Format {
             'schemes' => 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https; src: cid, http, https, data',
             'hook_tag' => function($e, $a=0) { return Format::__html_cleanup($e, $a); },
             'elements' => '*+iframe',
-            'spec' => 'iframe=-*,height,width,type,src(match="`^(https?:)?//(www\.)?(youtube|dailymotion|vimeo)\.com/`i"),frameborder; div=data-mid',
+            'spec' => 'iframe=-*,height,width,type,src(match="`^(https?:)?//(www\.)?(youtube|dailymotion|vimeo)\.com/`i"),frameborder',
         );
 
         return Format::html($html, $config);
diff --git a/include/class.mailer.php b/include/class.mailer.php
index 41c0005aeb682e6d94d40b7ca054c6113e685a34..9c7638bce119eefad3a2110105fc43c8e7b5acf2 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -344,7 +344,7 @@ class Mailer {
         if (!(isset($options['text']) && $options['text'])) {
             if ($reply_tag || $mid_token) {
                 $message = "<div style=\"display:none\"
-                    data-mid=\"$mid_token\">$reply_tag</div>$message";
+                    class=\"mid-$mid_token\">$reply_tag</div>$message";
             }
             $txtbody = rtrim(Format::html2text($message, 90, false))
                 . ($mid_token ? "\nRef-Mid: $mid_token\n" : '');
diff --git a/include/class.thread.php b/include/class.thread.php
index 67f9bfbfab20c8b7e52045805475190ea3b205fa..c44cc3659aa0033cc89f4c5096e423469f38e97c 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -1006,7 +1006,7 @@ class ThreadEntry {
         }
 
         // Search for the message-id token in the body
-        if (preg_match('`(?:data-mid="|Ref-Mid: )([^"\s]*)(?:$|")`',
+        if (preg_match('`(?:class="mid-|Ref-Mid: )([^"\s]*)(?:$|")`',
                 $mailinfo['message'], $match))
             if ($thread = ThreadEntry::lookupByRefMessageId($match[1],
                     $mailinfo['email']))