David, > I have a project using amavis in order to add auto-compress feature when > mails meet specific rules. > I would like to know what function in Amavis::Custom can be use to : > > - List Mime-parts > - Extract files. > - Delete attached files > - Adding new attached files. > > I can do this by executing a specified external C program but i think > the right way is using hook inside amavis
Currently modifying a MIME structure or individual parts is not supported. The only thing coming close is to replace entire mail, using an interface to an external program such as altermime. Amavisd does build a MIME structure tree by calling MIME-Tools (resulting object from a MIME::Parser call is stored into $msginfo->mime_entity), but further decoding may replace individual parts stored on files (in directory ./parts in a working directory), so the $msginfo->mime_entity can not be used to always reconstruct a mail message from its (possibly modified) parts. MIMEDefang project does this, but the task is nontrivial. Some of the steps have already been taken in 2.6.*, e.g. adding an I/O interface for reading from a MIME::Entity object. As a minimum, what is still needed is to change the logic of decoding, and somehow preserve original MIME parts on files without making them visible to virus scanners when a part has been successfully decoded/decompressed. > I would like to know what function in Amavis::Custom can be use to : > - List Mime-parts Traverse $msginfo->mime_entity object. > - Extract files. Files are already stored in a directory: $msginfo->mail_tempdir . '/parts' > - Delete attached files As noted, can't be done individually, the only way currently is to replace an entire mail ('altermime'-like interface). Mark ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ AMaViS-user mailing list AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/