This is a discussion on [AMaViS-user] Re: Amavis and disclaimers within the Amavis User forums, part of the Anti-Spam and Anti-Virus Related Forums category; > I mailed you about a week ago about modifying amavis to append > disclaimers to mails. I finally came ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
> I mailed you about a week ago about modifying amavis to append
> disclaimers to mails. I finally came around to fiddeling with > the subject and added the following code at around line 6680 > in amavisd version 2.2.1 (right after the if( defined $explanation ) > block: > > $msginfo->mime_entity->sign( > File => '/etc/resolv.conf', > Remove => 0 > ); You still need to replace the $msginfo->mail_text Normally the $msginfo->mail_text is a file handle of an opened file email.txt. The forwarding code takes whatever is in a $msginfo->mail_text (a file handle or a MIME::Entity object) and sends it. Here is how 'defanging' code replaces a file by a newly-constructed MIME::Entity object: do_log(1, "DEFANGING MAIL: $s"); my($d) = defanged_mime_entity($conn,$msginfo,$explanation); $msginfo->mail_text($d); # substitute mail with rewritten version $msginfo->mail_text_fn(undef); # remove filename information There is one fundamental caveat with your approach of modifying existing MIME::Entity object: the original body stored on an external file in a parts subdirectory) may have been removed by now during the process of recursive mail decoding. You approach may work if decoding is entirely disabled, or if you set @keep_decoded_original_maps=(1); although I never tried it. Alternative approach is to prepare a new mail file from existing email.txt, close the $msginfo->mail_text descriptor, discard the old email.txt file and reopen $msginfo->mail_text on a new file. > Btw, once I have this cleanly implemented, do you want a patch of this? A general purpose solution requires substantially more work, it should be able to rebuild the MIME::Entity object from approved parts, similar to what mimedefang does. I'm not much interested in a partial solution. Mark ------------------------------------------------------- This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005 Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows Embedded(r) & Windows Mobile(tm) platforms, applications & content. Register by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click _______________________________________________ AMaViS-user mailing list AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/...fo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/ |