about summary refs log tree commit diff stats
path: root/worker
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-11-08 14:18:14 +0100
committerReto Brunner <reto@labrat.space>2020-11-14 15:40:13 +0100
commitdaf214a1f8b9ee1f8eabff9b1a2485eceb19cbd0 (patch)
treea5e34df7a424ac186d0ff0865105ca70b9993426 /worker
parent18b0ea571aa1d76af5f250583285a072d2b64c4a (diff)
downloadaerc-daf214a1f8b9ee1f8eabff9b1a2485eceb19cbd0.tar.gz
imap: strip <> from message-ids
Diffstat (limited to 'worker')
-rw-r--r--worker/imap/imap.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/worker/imap/imap.go b/worker/imap/imap.go
index e296e9b..29dbc10 100644
--- a/worker/imap/imap.go
+++ b/worker/imap/imap.go
@@ -48,6 +48,14 @@ func translateEnvelope(e *imap.Envelope) *models.Envelope {
 		return nil
 	}
 
+	// we strip the msgid of "<>" in order to be more compatible with go-message
+	// which wants to handle msgids without the markers
+	// note this is a very naive way of doing it but probably good enough
+	msgID := e.MessageId
+	if len(msgID) > 1 && msgID[0] == '<' && msgID[len(msgID)-1] == '>' {
+		msgID = msgID[1 : len(msgID)-1]
+	}
+
 	return &models.Envelope{
 		Date:      e.Date,
 		Subject:   e.Subject,
@@ -56,7 +64,7 @@ func translateEnvelope(e *imap.Envelope) *models.Envelope {
 		To:        translateAddresses(e.To),
 		Cc:        translateAddresses(e.Cc),
 		Bcc:       translateAddresses(e.Bcc),
-		MessageId: e.MessageId,
+		MessageId: msgID,
 	}
 }