Dovecot IMAP 服务器与 Horde Groupware ActiveSync - IMAP 服务器未报告更改的状态

Dovecot IMAP 服务器与 Horde Groupware ActiveSync - IMAP 服务器未报告更改的状态

我有一个在 Debian Linux 上运行带有 Dovecot IMAP 服务器的 Horde 群件。

使用 Horde 的 Web UI 效果很好,但是在使用 ActiveSync 时遇到了问题。

当在 Android 上使用 BlueMail 之类的客户端应用程序时,我无法在收件箱中看到最新的电子邮件消息。

activesync 日志显示以下内容:

[163168][2022-11-11T15:08:44+00:00] >>>: INBOX IMAP PREVIOUS MODSEQ: 190086

此行显示上次同步 INBOX 时,其 MODSEQ 值为 190086。每当有消息添加到邮箱时,IMAP 服务器报告的 modseq 值必须增加。

[163168][2022-11-11T15:08:44+00:00] >>>: IMAP status: a:4:{s:8:"messages";i:6874;s:7:"uidnext";i:157933;s:11:"uidvalidity";i:1291740963;s:13:"highestmodseq";i:190086;}

这一行显示了我的 IMAP 服务器报告的当前 MODSEQ,表明服务器没有报告任何改变的状态。

这怎么可能?我在收件箱中收到了新邮件,但它没有显示在应用程序中。

通过 Thunderbird 直接访问 IMAP 服务器,显示所有新电子邮件。

它之前可以在 FreeBSD 上的 Dovecot 服务器上运行,但我已将 Dovecot 迁移到 Debian Linux。

有什么想法我的 Dovecot 配置可能有什么问题吗?

我主要使用 Dovecot 的标准配置,尤其是 IMAP 设置。

这是我的 imap 特定配置:

##
## IMAP specific settings
##

# If nothing happens for this long while client is IDLEing, move the connection
# to imap-hibernate process and close the old imap process. This saves memory,
# because connections use very little memory in imap-hibernate process. The
# downside is that recreating the imap process back uses some resources.
#imap_hibernate_timeout = 0

# Maximum IMAP command line length. Some clients generate very long command
# lines with huge mailboxes, so you may need to raise this if you get
# "Too long argument" or "IMAP command line too large" errors often.
#imap_max_line_length = 64k

# IMAP logout format string:
#  %i - total number of bytes read from client
#  %o - total number of bytes sent to client
#  %{fetch_hdr_count} - Number of mails with mail header data sent to client
#  %{fetch_hdr_bytes} - Number of bytes with mail header data sent to client
#  %{fetch_body_count} - Number of mails with mail body data sent to client
#  %{fetch_body_bytes} - Number of bytes with mail body data sent to client
#  %{deleted} - Number of mails where client added \Deleted flag
#  %{expunged} - Number of mails that client expunged, which does not
#                include automatically expunged mails
#  %{autoexpunged} - Number of mails that were automatically expunged after
#                    client disconnected
#  %{trashed} - Number of mails that client copied/moved to the
#               special_use=\Trash mailbox.
#  %{appended} - Number of mails saved during the session
#imap_logout_format = in=%i out=%o deleted=%{deleted} expunged=%{expunged} \
#  trashed=%{trashed} hdr_count=%{fetch_hdr_count} \
#  hdr_bytes=%{fetch_hdr_bytes} body_count=%{fetch_body_count} \
#  body_bytes=%{fetch_body_bytes}

# Override the IMAP CAPABILITY response. If the value begins with '+',
# add the given capabilities on top of the defaults (e.g. +XFOO XBAR).
#imap_capability =

# How long to wait between "OK Still here" notifications when client is
# IDLEing.
#imap_idle_notify_interval = 2 mins

# ID field names and values to send to clients. Using * as the value makes
# Dovecot use the default value. The following fields have default values
# currently: name, version, os, os-version, support-url, support-email,
# revision.
#imap_id_send =

# ID fields sent by client to log. * means everything.
#imap_id_log =

# Workarounds for various client bugs:
#   delay-newmail:
#     Send EXISTS/RECENT new mail notifications only when replying to NOOP
#     and CHECK commands. Some clients ignore them otherwise, for example OSX
#     Mail (<v2.1). Outlook Express breaks more badly though, without this it
#     may show user "Message no longer in server" errors. Note that OE6 still
#     breaks even with this workaround if synchronization is set to
#     "Headers Only".
#   tb-extra-mailbox-sep:
#     Thunderbird gets somehow confused with LAYOUT=fs (mbox and dbox) and
#     adds extra '/' suffixes to mailbox names. This option causes Dovecot to
#     ignore the extra '/' instead of treating it as invalid mailbox name.
#   tb-lsub-flags:
#     Show \Noselect flags for LSUB replies with LAYOUT=fs (e.g. mbox).
#     This makes Thunderbird realize they aren't selectable and show them
#     greyed out, instead of only later giving "not selectable" popup error.
#
# The list is space-separated.
#imap_client_workarounds =

# Host allowed in URLAUTH URLs sent by client. "*" allows all.
#imap_urlauth_host =

# Enable IMAP LITERAL- extension (replaces LITERAL+)
#imap_literal_minus = no

# What happens when FETCH fails due to some internal error:
#   disconnect-immediately:
#     The FETCH is aborted immediately and the IMAP client is disconnected.
#   disconnect-after:
#     The FETCH runs for all the requested mails returning as much data as
#     possible. The client is finally disconnected without a tagged reply.
#   no-after:
#     Same as disconnect-after, but tagged NO reply is sent instead of
#     disconnecting the client. If the client attempts to FETCH the same failed
#     mail more than once, the client is disconnected. This is to avoid clients
#     from going into infinite loops trying to FETCH a broken mail.
#imap_fetch_failure = disconnect-immediately

protocol imap {
  # Space separated list of plugins to load (default is global mail_plugins).
  #mail_plugins = $mail_plugins

  # Maximum number of IMAP connections allowed for a user from each IP address.
  # NOTE: The username is compared case-sensitively.
  #mail_max_userip_connections = 10

我的 maildir 特定设置:


##
## Maildir-specific settings
##

# By default LIST command returns all entries in maildir beginning with a dot.
# Enabling this option makes Dovecot return only entries which are directories.
# This is done by stat()ing each entry, so it causes more disk I/O.
# (For systems setting struct dirent->d_type, this check is free and it's
# done always regardless of this setting)
#maildir_stat_dirs = no

# When copying a message, do it with hard links whenever possible. This makes
# the performance much better, and it's unlikely to have any side effects.
#maildir_copy_with_hardlinks = yes

# Assume Dovecot is the only MUA accessing Maildir: Scan cur/ directory only
# when its mtime changes unexpectedly or when we can't find the mail otherwise.
maildir_very_dirty_syncs = no

# If enabled, Dovecot doesn't use the S=<size> in the Maildir filenames for
# getting the mail's physical size, except when recalculating Maildir++ quota.
# This can be useful in systems where a lot of the Maildir filenames have a
# broken size. The performance hit for enabling this is very small.
#maildir_broken_filename_sizes = no

# Always move mails from new/ directory to cur/, even when the \Recent flags
# aren't being reset.
#maildir_empty_new = no

有人知道为什么 MODSEQ 没有更新吗?

鸽舍-n:

# 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.13 (cdd19fe3)
# OS: Linux 5.10.0-19-amd64 x86_64 Debian 11.5
# Hostname: mail01.public.forberger-online.de
auth_mechanisms = plain login
mail_location = maildir:~/.maildir
mail_privileged_group = mail
mailbox_list_index_include_inbox = yes
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix =
}
passdb {
  driver = pam
}
protocols = " imap"
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}
service imap-login {
  client_limit = 256
  inet_listener imap {
    address = 192.168.108.1, 127.0.0.1, [::1]
    port = 143
  }
  inet_listener imaps {
    address = 192.168.108.1, 127.0.0.1, [::1]
    port = 993
    ssl = yes
  }
  process_min_avail = 6
}
ssl_ca = </etc/letsencrypt/live/mail.forberger-online.de/chain.pem
ssl_cert = </etc/letsencrypt/live/mail.forberger-online.de/cert.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
ssl_min_protocol = TLSv1.2
userdb {
  driver = passwd
}

重要提示:文件夹 INBOX 上的 MODSEQ 不会增加:

* OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ AUTH=PLAIN AUTH=LOGIN] Dovecot (Debian) ready.
A login REDACTED REDACTED
A OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY STATUS=SIZE SAVEDATE LITERAL+ NOTIFY SPECIAL-USE] Logged in
A status INBOX (messages)
* STATUS INBOX (MESSAGES 7247)
A OK Status completed (0.001 + 0.000 secs).
1 SELECT Inbox
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $MDNSent Junk NonJunk $label4 $label1 $label2 $label3 $label5 Old $Forwarded NOTJUNK $has_cal)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft $MDNSent Junk NonJunk $label4 $label1 $label2 $label3 $label5 Old $Forwarded NOTJUNK $has_cal \*)] Flags permitted.
* 7247 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1291740963] UIDs valid
* OK [UIDNEXT 158406] Predicted next UID
* OK [HIGHESTMODSEQ 190086] Highest
1 OK [READ-WRITE] Select completed (0.010 + 0.000 + 0.009 secs).

如您所见,HIGHESTMODSEQ 保持在 190086。但我收到了大量新电子邮件。

HIGHESTMODSEQ 没有增加可能是什么问题?

答案1

你知道有什么方法可以测试 IMAP 服务器是否增加了 MODSEQ

似乎下一步是手动连接并

  1. 坚持使用在(预期和宣传的) CONDSTORE 功能不可用时会产生错误的命令。
  2. 检查在使用前后测试操作反复请求时,哪些操作(接收消息、使用 thunderbird 拖放功能在文件夹之间移动消息、执行doveadm index、、 ..)会增加Dovecot 报告的值,doveadm force-resync哪些不会增加。HIGHESTMODSEQSELECT

像这样:

# openssl s_client -quiet -crlf -connect [::1]:993
* OK [CAPABILITY IMAP4rev1  .. AUTH=LOGIN ..] Dovecot (Debian) ready.
A LOGIN [email protected] password
A OK [CAPABILITY IMAP4rev1  .. CONDSTORE QRESYNC ..] Logged in
A ENABLE CONDSTORE QRESYNC
* OK [HIGHESTMODSEQ 1337] Highest
* ENABLED CONDSTORE QRESYNC
A OK ENABLED (..).
A SELECT INBOX (CONDSTORE)
...
* OK [HIGHESTMODSEQ 1338] Highest
A OK [READ-WRITE] SELECT completed (..).
A SELECT INBOX (CONDSTORE)
...
* OK [HIGHESTMODSEQ 1400] Highest
A OK [READ-WRITE] SELECT completed (..).

确认问题已存在于 IMAP 级别后,您可以继续执行该级别。甚至可以调查数字 190086 的确切来源。我想到了一个极端情况,Dovecot 错误地报告了一个数字,该数字指的是无法更新的东西,因为它不再可访问。然后通过读取索引文件的文本表示将指向该消息 - 在该消息上添加 IMAP 标志应该会触发doveadm mailbox status -u [email protected] all NewlyCreatedFolderdoveadm dump -t index /file/path/to/mailbox/dovecot.index | grep -B 10 -A 100 "modseq.*190086"一些结果或许可以指出问题的本质。

答案2

现在又可以正常工作了。我使用重新创建了 maildir(我只有一个),maildirmake并将邮件移回原处。感谢大家的帮助。

相关内容