aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/imap.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/imap.go')
-rw-r--r--plugins/base/imap.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/base/imap.go b/plugins/base/imap.go
index 3492e7e..07b69c7 100644
--- a/plugins/base/imap.go
+++ b/plugins/base/imap.go
@@ -210,6 +210,29 @@ func (msg *IMAPMessage) TextPart() *IMAPPartNode {
return best
}
+func (msg *IMAPMessage) HTMLPart() *IMAPPartNode {
+ if msg.BodyStructure == nil {
+ return nil
+ }
+
+ var best *IMAPPartNode
+ msg.BodyStructure.Walk(func(path []int, part *imap.BodyStructure) bool {
+ if !strings.EqualFold(part.MIMEType, "text") {
+ return true
+ }
+ if part.Disposition != "" && !strings.EqualFold(part.Disposition, "inline") {
+ return true
+ }
+
+ if part.MIMESubType == "html" {
+ best = newIMAPPartNode(msg, path, part)
+ }
+ return true
+ })
+
+ return best
+}
+
func (msg *IMAPMessage) Attachments() []IMAPPartNode {
if msg.BodyStructure == nil {
return nil