diff --git a/plugins/notifier/abstract.inc b/plugins/notifier/abstract.inc
index 5418db7..686830f 100644
--- a/plugins/notifier/abstract.inc
+++ b/plugins/notifier/abstract.inc
@@ -20,18 +20,23 @@ class MessageDigest extends MessageNotifierBase {
       'sent' => FALSE,
       'timestamp' => $message->timestamp,
     );
-
+    // This will only have a value if the message is not a message_subscribe
+    // message.
+    $mid = $message->mid;
     // Our $message is a cloned copy of the original $message with the mid field removed to
     // prevent overwriting (this happens in message_subscribe) so we need to fetch the mid manually.
-    $mid = db_select('message', 'm')
-      ->fields('m', array('mid'))
-      ->condition('timestamp', $message->timestamp)
-      ->execute()
-      ->fetchField();
-    if (!empty($mid)) {
-      $message_digest['mid'] = $mid;
+
+    if (empty($mid)) {
+      $mid = db_select('message', 'm')
+        ->fields('m', array('mid'))
+        ->condition('timestamp', $message->timestamp)
+        ->condition('type', $message->type)
+        ->execute()
+        ->fetchField();
     }
 
+    $message_digest['mid'] = $mid;
     drupal_write_record('message_digest', $message_digest);
 
     return TRUE;
