forked from Silverfish/proton-bridge
GODT-2002: Poll after SMTP send
After sending, a client might append to the sent folder over IMAP. In this case, we perform deduplication and return the message ID of the sent message. However, if we haven't already processed this message in gluon, it doesn't work as expected. This change polls the event stream immediately after send. Note that it doesn't wait for these events to be processed; that should be done in a follow-up commit.
This commit is contained in:
@ -268,6 +268,8 @@ func (conn *imapConnector) CreateMessage(
|
||||
if messageID, ok, err := conn.sendHash.hasEntryWait(ctx, hash, time.Now().Add(90*time.Second)); err != nil {
|
||||
return imap.Message{}, nil, fmt.Errorf("failed to check send hash: %w", err)
|
||||
} else if ok {
|
||||
conn.log.WithField("messageID", messageID).Debug("Message already sent")
|
||||
|
||||
message, err := conn.client.GetMessage(ctx, messageID)
|
||||
if err != nil {
|
||||
return imap.Message{}, nil, fmt.Errorf("failed to fetch message: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user