Re: Remove attachments

2023-06-06 Thread John Stoffel
> "Oliver" == Oliver Glas  writes:

https://mimedefang.org/ is where I'd go to look for details on how to
implement it. I haven't done it myself.

> Is it possible to get a documentation for that ?
> Or a description how to implement that ?

> Am 03.06.23 um 23:28 schrieb John Stoffel:

> "Oliver" == Oliver Glas  writes:

> I am looking for a way to remove attachments, based on a condition.
> Like attachments starting with "TimeReport" shall be removed, and
> then the mail should be delivered, with all other attachments.

> This is not a solution that dovecat can work with.  You need to use a
> milter in your mailserver (like postfix) which can strip out mime
> attachements or do other modifications to an email before it's
> delivered to the mailbox.  

> I did so far not find a solution to remove attachments.  Do I need a
> plugin / extension  ? If so, how to implement and use that ?

> milters are what you want.  MIMEdefang is one.  

> John

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: Remove attachments

2023-06-06 Thread Oscar del Rio



On 2023-06-06 1:36 p.m., John Stoffel wrote:

"Oliver" == Oliver Glas  writes:

https://mimedefang.org/ is where I'd go to look for details on how to
implement it. I haven't done it myself.



Most likely in the "filter" function of "mimedefang-filter" perl script:

#***
# %PROCEDURE: filter
# %ARGUMENTS:
#  entity -- a Mime::Entity object (see MIME-tools documentation for 
details)

#  fname -- the suggested filename, taken from the MIME Content-Disposition:
#   header.  If no filename was suggested, then fname is ""
#  ext -- the file extension (everything from the last period in the name
# to the end of the name, including the period.)
#  type -- the MIME type, taken from the Content-Type: header.
#
#  NOTE: There are two likely and one unlikely place for a filename to
#  appear in a MIME message:  In Content-Disposition: filename, in
#  Content-Type: name, and in Content-Description.  If you are paranoid,
#  you will use the re_match and re_match_ext functions, which return true
#  if ANY of these possibilities match.  re_match checks the whole name;
#  re_match_ext checks the extension.  See the sample filter below for 
usage.

# %RETURNS:
#  Nothing
# %DESCRIPTION:
#  This function is called once for each part of a MIME message.
#  There are many action_*() routines which can decide the fate
#  of each part; see the mimedefang-filter man page.
#***

Within the "filter" function, there are several options (actions) on 
what to do with the MIME entity:
e.g. "action_drop", "action_drop_with_warning", 
"action_replace_with_warning"

https://mimedefang.org/man_Mail::MIMEDefang::Actions.html

___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org