MimeMessage msg; using (var stream = File.OpenRead(fileName)) { msg = MimeMessage.Load(stream); } foreach (var part in msg.BodyParts.OfTypeMimeKit().Where(part => !string.IsNullOrEmpty(part.FileName))) { using (var stream = File.OpenWrite(Path.Combine(Path.GetDirectoryName(fileName), part.FileName))) { part.ContentObject.DecodeTo(stream); } }