diff --git a/src/api.py b/src/api.py
index ad5a142a..dd883d9a 100644
--- a/src/api.py
+++ b/src/api.py
@@ -1459,6 +1459,13 @@ class BMRPCDispatcher(object):
             return None
         return data
 
+    @testmode('undeleteMessage')
+    def HandleUndeleteMessage(self, msgid):
+        """Undelete message"""
+        msgid = self._decode(msgid, "hex")
+        helper_inbox.undeleteMessage(msgid)
+        return "Undeleted message"
+
     @command('deleteAndVacuum')
     def HandleDeleteAndVacuum(self):
         """Cleanup trashes and vacuum messages database"""
diff --git a/src/helper_inbox.py b/src/helper_inbox.py
index 654dd59d..d99e9544 100644
--- a/src/helper_inbox.py
+++ b/src/helper_inbox.py
@@ -18,6 +18,11 @@ def trash(msgid):
     queues.UISignalQueue.put(('removeInboxRowByMsgid', msgid))
 
 
+def undeleteMessage(msgid):
+    """Undelte the message"""
+    sqlExecute('''UPDATE inbox SET folder='inbox' WHERE msgid=?''', msgid)
+
+
 def isMessageAlreadyInInbox(sigHash):
     """Check for previous instances of this message"""
     queryReturn = sqlQuery(
diff --git a/src/tests/test_api.py b/src/tests/test_api.py
index f0d52c5c..ba197127 100644
--- a/src/tests/test_api.py
+++ b/src/tests/test_api.py
@@ -97,9 +97,8 @@ class TestAPI(TestAPIProto):
             sample_statusbar_msg
         )
 
-    def test_message_inbox_and_trash(self):
+    def test_message_inbox(self):
         """Test message inbox methods"""
-        # Inbox function related tests
         self.assertEqual(
             len(json.loads(
                 self.api.getAllInboxMessages())["inboxMessages"]),
@@ -122,7 +121,9 @@ class TestAPI(TestAPIProto):
             4
         )
 
-        # Trash function related tests
+    def test_message_trash(self):
+        """Test message inbox methods"""
+
         messages_before_delete = len(json.loads(self.api.getAllInboxMessageIds())["inboxMessageIds"])
         self.assertEqual(
             self.api.trashMessage(hexlify(sample_inbox_msg_ids[0])),
@@ -136,6 +137,18 @@ class TestAPI(TestAPIProto):
             len(json.loads(self.api.getAllInboxMessageIds())["inboxMessageIds"]),
             messages_before_delete - 2
         )
+        self.assertEqual(
+            self.api.undeleteMessage(hexlify(sample_inbox_msg_ids[0])),
+            'Undeleted message'
+        )
+        self.assertEqual(
+            self.api.undeleteMessage(hexlify(sample_inbox_msg_ids[1])),
+            'Undeleted message'
+        )
+        self.assertEqual(
+            len(json.loads(self.api.getAllInboxMessageIds())["inboxMessageIds"]),
+            messages_before_delete
+        )
 
     def test_clientstatus_consistency(self):
         """If networkStatus is notConnected networkConnections should be 0"""