On 2023-06-06 1:36 p.m., John Stoffel wrote:
"Oliver" == Oliver Glas <oliver.glas@inss.ch> 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