From 1194b98e541cbe11af7c28e21590eb6d401fbaa0 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 3 Dec 2019 15:06:29 +0100 Subject: [PATCH] Fix EOF on message view --- imap.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/imap.go b/imap.go index 14d59c8..8aaad6f 100644 --- a/imap.go +++ b/imap.go @@ -253,12 +253,20 @@ func getMessagePart(conn *imapclient.Client, mboxName string, uid uint32, partPa var partHeaderSection imap.BodySectionName partHeaderSection.Peek = true - partHeaderSection.Specifier = imap.HeaderSpecifier + if len(partPath) > 0 { + partHeaderSection.Specifier = imap.MIMESpecifier + } else { + partHeaderSection.Specifier = imap.HeaderSpecifier + } partHeaderSection.Path = partPath var partBodySection imap.BodySectionName partBodySection.Peek = true - partBodySection.Specifier = imap.TextSpecifier + if len(partPath) > 0 { + partBodySection.Specifier = imap.EntireSpecifier + } else { + partBodySection.Specifier = imap.TextSpecifier + } partBodySection.Path = partPath fetch := []imap.FetchItem{