private string ProcessHtmlBody(string rawHtmlBody)
        {
            // Clear the files in temporary storage.
            DirectoryInfo di = new DirectoryInfo(cidContentDirPath);

            foreach (FileInfo file in di.GetFiles())
            {
                file.Delete();
            }
            foreach (DirectoryInfo dir in di.GetDirectories())
            {
                dir.Delete(true);
            }

            // Save all attachments and obtain their <cid, filePath> pairs.
            this.savedCidContents.Clear();
            MimeUtility.SaveBinariesWithCid(Message.Body, cidContentDirPath, this.savedCidContents);

            HtmlDocument html = new HtmlDocument();

            html.LoadHtml(rawHtmlBody);

            var rootNode = html.DocumentNode;
            var imgNodes = rootNode.Descendants("img");

            // Fix all cid references with corresponding file system paths.
            foreach (HtmlNode node in imgNodes)
            {
                string srcAttr = node.GetAttributeValue("src", null);
                if (srcAttr != null)
                {
                    Match m = Regex.Match(srcAttr, "cid:(.*)");
                    if (m.Success)
                    {
                        string cid = m.Groups[1].Value.Trim(' ');
                        if (this.savedCidContents.ContainsKey(cid))
                        {
                            node.SetAttributeValue("src", this.savedCidContents[cid]);
                        }
                    }
                }
            }

            return(rootNode.InnerHtml);
        }