First of all, thanks for this fantastic project!
In one of my applications we create email drafts and use IMAP APPEND. It works well with the production servers.
However, using mokapi, IMAP APPEND command fails with a parse error when the message includes both flags and an internal date, even though the command is syntactically valid per RFC 3501 §6.3.11.
To Reproduce:
Connect to Mokapi's IMAP server using Python's imaplib and call append with flags and a date:
import imaplib, time
server = imaplib.IMAP4(host="localhost", port=143)
server.login("user@example.com", "test")
server.select("Drafts")
server.append(
'"Drafts"',
r"\Draft",
imaplib.Time2Internaldate(time.time()),
b"Subject: Test\r\n\r\nBody"
)
To rule out an issue with imaplib I also did a similar test using Thunderbird, which leads to the same issue.
Expected behavior
The message is appended to the Drafts folder.
Actual behavior
Mokapi logs the following error:
imap: parse command failed 'LFKG3 APPEND "Drafts" (\Draft) "26-Apr-2026 14:20:31 +0200" {53367}': expected SP, got "Drafts" (\Draft) "26-Apr-2026 14:20:31 +0200" {53367}
The same error occurs with an unquoted mailbox name (Drafts instead of "Drafts").
Mokapi configuration
mail: '1.0'
info:
title: Dev Mail Server
servers:
imap:
host: :143
protocol: imap
mailboxes:
user@example.com:
username: user@example.com
password: "test"
folders:
Drafts:
flags: [\\Drafts]
settings:
allowPlainTextLogin: true
RFC 3501 reference
The APPEND syntax per RFC 3501:
append = "APPEND" SP mailbox 1*append-message
append-message = [SP flag-list] [SP date-time] SP literal
Both flags and date-time are optional but valid. The command Mokapi rejects is fully conformant.
Environment
Mokapi version: latest (Docker image mokapi/mokapi:latest)
Client: Python imaplib (Python 3.11)
First of all, thanks for this fantastic project!
In one of my applications we create email drafts and use IMAP APPEND. It works well with the production servers.
However, using
mokapi, IMAP APPEND command fails with a parse error when the message includes both flags and an internal date, even though the command is syntactically valid per RFC 3501 §6.3.11.To Reproduce:
Connect to Mokapi's IMAP server using Python's
imapliband callappendwith flags and a date:To rule out an issue with
imaplibI also did a similar test using Thunderbird, which leads to the same issue.Expected behavior
The message is appended to the
Draftsfolder.Actual behavior
Mokapi logs the following error:
The same error occurs with an unquoted mailbox name (
Draftsinstead of"Drafts").Mokapi configuration
RFC 3501 reference
The APPEND syntax per RFC 3501:
Both flags and date-time are optional but valid. The command Mokapi rejects is fully conformant.
Environment
Mokapi version: latest (Docker image mokapi/mokapi:latest)
Client: Python imaplib (Python 3.11)