I'm trying to automatically detect emails with attachments and copy them to a specific folder. My Roundcubemail + Sieve setup works and can successfully filter emails and act on them.
However, I can't seem to figure out how to detect the presence of attachments. In an email's source that has attachments, one can usually find this section:
----=_NextPart_...
Content-Disposition: attachment; filename="..."
So I tried creating a filter for the body that reacts upon the body containing the word attachment
as a minimal test case. However, the filter does not fire when I sent an email with an attachment.
The same happens if I create a filter for the header Content-Disposition
which should contain the word attachment
. My guess is that the Dovecot Managesieve
plugin does not filter the entire source of the email, so it never encounters aforementioned section, neither in body, nor in the headers. Alternatively, Roundcubemail is presenting the email source to me in a different way than what Sieve processes and I'm therefore looking for the wrong pattern.
Does anyone know a Sieve script that could detect attachments, or a different way to achieve what I'm trying to do using Roundcubemail?