Intermittent IMAP fetching with Gmail on package installation - manual Channel.fetch always works

Hello,

I am currently evaluating Zammad in a test environment before deploying a production installation using the official Docker deployment and Exchange Online.

Environment:

  • Zammad version: 20260703070405
  • Installation type: Package installation
  • OS: Ubuntu Server 24.04 LTS
  • Elasticsearch 8.19.x
  • Mail provider: Gmail
  • IMAP: imap.gmail.com (SSL, port 993)
  • SMTP: smtp.gmail.com
  • Single inbound Gmail channel
  • Single outbound Gmail channel

Issue description:

I am experiencing very inconsistent email fetching behavior.

The strange part is that everything appears healthy:

  • IMAP connection is green
  • SMTP connection is green
  • Email account is active
  • Zammad worker is running
  • Elasticsearch connection is working
  • Search index rebuild completed successfully
  • Monitoring shows no errors

Symptoms:

Sometimes incoming emails create tickets immediately.

Sometimes the first emails are completely ignored.

Example:

  • Email #1 → not imported
  • Email #2 → not imported
  • Email #3 → imported
  • Afterwards emails #4, #5, #6 are imported normally

In another test:

  • Email #1 → not imported
  • Email #2 → not imported
  • Email #3 → not imported
  • Email #4 → not imported
  • Email #5 → imported
  • Afterwards email processing started working normally.

The behavior is not reproducible based on sender address or ticket state.

Additional observations:

When a ticket is not created automatically, running:

Channel.fetch

from Rails console often imports the email immediately.

However, I have also seen cases where timing seems relevant:

  • Email arrives in Gmail Inbox
  • Immediate Channel.fetch imports the email successfully
  • Waiting some time and then running Channel.fetch may result in “no message”

The email remains visible in Gmail Inbox.

Production log examples:

Successful fetch:

  • fetching imap (…)
  • message 1/1
  • Process email with msgid …
  • Ticket created

Unsuccessful fetch:

  • fetching imap (…)
  • no message

even though the email is visible in Gmail Inbox.

Temporary workaround:

I created a script that executes:

Channel.fetch

every 10 seconds.

With this workaround:

  • 5/5 emails imported
  • 10/10 emails imported
  • No missing tickets observed

Questions:

  1. Has anyone seen similar behavior with Gmail IMAP?
  2. Is there a known issue affecting automatic fetching while manual Channel.fetch works reliably?
  3. Is there a way to increase logging/debugging for the IMAP fetch process?
  4. Are there any known fixes in Docker deployments or newer versions?

This is currently only a testing environment. Before moving to Docker + Exchange Online in production, I would like to understand the root cause.

Thank you!