Re: [exim] Attachment count

Top Pagina
Delete this message
Reply to this message
Auteur: Dave
Datum:  
Aan: exim-users
Onderwerp: Re: [exim] Attachment count
On 12/01/2018 09:29, Jeremy Harris wrote:
> On 12/01/18 09:14, John McMurray via Exim-users wrote:
>> Is there some way of counting attachments in the exim config file to
>> block mails with > than n number of attachments?
>
> Presumably each attachment was a MIME part. Run a MIME ACL:
>
> http://exim.org/exim-html-current/doc/html/spec_html/ch-content_scanning_at_acl_time.html#SECTscanmimepart
>
> and have it incrementing a counter. Deny when it gets
> too large.


I was going to suggest using $mime_part_count, but I believe this gets reset
when processing attachments?

acl_smtp_mime = acl_check_mime

begin acl

acl_check_mime:

    deny    condition    = ${if >{$mime_part_count}{200}}
        message        = Message contains too many MIME parts


So I guess you could explicitly count attachments more like this:

    deny    condition          = $mime_is_rfc822
        set acl_m_attachments = ${eval: $acl_m_attachments + 1}
        condition          = ${if >{$acl_m_attachments}{200}}
        message              = Message contains too many attachments


--
Dave