james-rant
I'm fetching emails from Gmail, using Postal. I fetch the last 100 emails, with all flags (`[.structure, .size, .flags, .headers, .gmailLabels, .gmailThreadID, .gmailMessageID, .body, .fullHeaders, .headerSubject]`), and then iterate over each fetch result's `body.allParts` and fetch the attachments for each part. When I do this, I don't ever see any text/html parts, only ever text/plain, but when viewing the raw source of the mail on Gmail, it shows there is a text/html and a text/plain. My code looks like so: ```swift func fetchMail(in folder: Folder) { mailService?.fetchLast(folder.name, last: 100, flags: allFlags, onMessage: { result in result.body?.allParts.forEach { part in print(part.mimeType) // This always prints "text/plain" self.mailService?.fetchAttachments(folder.name, uid: result.uid, partId: part.id, onAttachment: { mailData in if let data = Data(base64Encoded: mailData.decodedData, options: .ignoreUnknownCharacters) { let content = String(data: data, encoding: .utf8) print(content) // this is always a plain text representation } else { let content = String(data: mailData.decodedData, encoding: .utf8) print(content) // this is always a plain text representation } }, onComplete: { error in if let error = error { print("Error fetching attachment: \(error)") } }) } }, onComplete: { error in if let error = error { print("error fetching email in \(folder.name): \(error)") return } }) } ``` An example of the log when I'm testing this is as follows: ``` text/plain Optional("D4Test was granted access to your Google account\r\n\r\n\r\[email protected]\r\n\r\nIf you did not grant access, you should check this activity and secure your\r\naccount.\r\nCheck activity\r\n<https://accounts.google.com/[email protected]&continue=https://myaccount.google.com/alert/nt/1570456286000?rfn%3D127%26rfnc%3D1%26eid%3D650020303090366957%26et%3D0%26anexp%3Dgivab-fa--mdv2-fa>\r\nYou received this email to let you know about important changes to your\r\nGoogle Account and services.\r\n© 2019 Google LLC, 1600 Amphitheatre Parkway, Mountain View, CA 94043, USA\r\n") ``` But when I check the source of the email via the Gmail website it shows two parts of the email, one text/plain, which is the plain text encoded as bas64, and the other text/html, but the html part does not appear in the parts in the Postal response.