Allow the use of X-Zammad-* headers over IMAP

Zammad supports several X-Zammad-* headers which can influence how Zammad processes a mail, as documented here.

For example with the following header I could tell Zammad to sort a new ticket into a specific group:

X-Zammad-Ticket-Group: Sales

Unfortunately, Zammad only seems to interpret these headers when it reads the mail from a trusted channel, and as far as I can tell, all channels are by default untrusted. The only way to get a trusted channel is to pipe mail into a MailStdin channel:

cat mail | rails r ' true)'

But this doesn’t seem to be the recommended way to get mail into Zammad because it is slow and has a lot of overhead due to the fact that it needs to start a new Rails instance every time it needs to process a mail. IMAP seems to be preferred.

I’ve looked through the code, but as far as I can tell, there’s no way to configure an IMAP channel as trusted. I’ve therefore come up with the following rather ugly workaround that essentially makes all channels trusted:

  1. Create backup of the 0010_postmaster_filter_trusted setting:

    psql -c "COPY (SELECT * FROM settings WHERE name = '0010_postmaster_filter_trusted') TO STDOUT" > 0010_postmaster_filter_trusted.txt
  2. Delete the setting (I’ve found no way to disable it; setting it to '' will crash the email parser) in the Rails console:

    Setting.find_by(name: '0010_postmaster_filter_trusted').delete
  3. Restart the scheduler to apply the change. Zammad should now accept X-Zammad-* headers via IMAP.

  4. In case you want to undo the change:

    psql -c "COPY settings FROM STDIN" < 0010_postmaster_filter_trusted.txt

    Then restart the scheduler again.

It would be nice if a proper setting for this could be added that allows me to configure specific IMAP channels as trusted. Or is there already a way and I’ve overlooked it? :slight_smile:

1 Like

This topic was automatically closed after 416 days. New replies are no longer allowed.