{"action":"created","issue":{"url":"https://api.github.com/repos/jstedfast/MimeKit/issues/232","repository_url":"https://api.github.com/repos/jstedfast/MimeKit","labels_url":"https://api.github.com/repos/jstedfast/MimeKit/issues/232/labels{/name}","comments_url":"https://api.github.com/repos/jstedfast/MimeKit/issues/232/comments","events_url":"https://api.github.com/repos/jstedfast/MimeKit/issues/232/events","html_url":"https://github.com/jstedfast/MimeKit/issues/232","id":138537345,"number":232,"title":"Conversion from MailMessage doesn't have TextParts","user":{"login":"RoryStawart","id":13798919,"avatar_url":"https://avatars.githubusercontent.com/u/13798919?v=3","gravatar_id":"","url":"https://api.github.com/users/RoryStawart","html_url":"https://github.com/RoryStawart","followers_url":"https://api.github.com/users/RoryStawart/followers","following_url":"https://api.github.com/users/RoryStawart/following{/other_user}","gists_url":"https://api.github.com/users/RoryStawart/gists{/gist_id}","starred_url":"https://api.github.com/users/RoryStawart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoryStawart/subscriptions","organizations_url":"https://api.github.com/users/RoryStawart/orgs","repos_url":"https://api.github.com/users/RoryStawart/repos","events_url":"https://api.github.com/users/RoryStawart/events{/privacy}","received_events_url":"https://api.github.com/users/RoryStawart/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-04T17:43:14Z","updated_at":"2016-03-04T18:42:58Z","closed_at":"2016-03-04T18:42:58Z","body":"For a project that uses this, we build MailMessages and then send them out before logging them. For security, we need to replace a piece of text in the body with a useless string. The problem we faced is that the body parts were all MimePart, not the expected `TextParts`.\r\n\r\nOur mail handler can accept a MailMessage which is converted using `MimeMessage.CreateFromMailMessage`, but when we go to work with the MimeMessage object in our logger, it only contains MimeParts under message.BodyParts (and likewise if we traverse the tree through message.Body).\r\n\r\nThe solution we found was to write the MimeMessage to a stream and then load a new object from the stream. This yields the expected TextParts that we are able to modify."},"comment":{"url":"https://api.github.com/repos/jstedfast/MimeKit/issues/comments/192403029","html_url":"https://github.com/jstedfast/MimeKit/issues/232#issuecomment-192403029","issue_url":"https://api.github.com/repos/jstedfast/MimeKit/issues/232","id":192403029,"user":{"login":"jstedfast","id":338984,"avatar_url":"https://avatars.githubusercontent.com/u/338984?v=3","gravatar_id":"","url":"https://api.github.com/users/jstedfast","html_url":"https://github.com/jstedfast","followers_url":"https://api.github.com/users/jstedfast/followers","following_url":"https://api.github.com/users/jstedfast/following{/other_user}","gists_url":"https://api.github.com/users/jstedfast/gists{/gist_id}","starred_url":"https://api.github.com/users/jstedfast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jstedfast/subscriptions","organizations_url":"https://api.github.com/users/jstedfast/orgs","repos_url":"https://api.github.com/users/jstedfast/repos","events_url":"https://api.github.com/users/jstedfast/events{/privacy}","received_events_url":"https://api.github.com/users/jstedfast/received_events","type":"User","site_admin":false},"created_at":"2016-03-04T18:42:58Z","updated_at":"2016-03-04T18:42:58Z","body":"Thanks for the bug report!"}}