On 2009-12-14 at 09:16:29 +0200, Lucian @ lastdot.org wrote: > I need to delete all attachments from emails at server level. I'm > using stock postfix in Centos 5 (v 2.3.3). > I found renattach (http://www.pc-tools.net/unix/renattach/), but this > software seems to have been discontinued and the author does not > recommend it anymore. > Can you recommend another method of deleting attachments?
I tweaked detach (found here: http://detach.optimism.cc/). Instead of saving attachments to a directory and putting URLs in the message, it saves the attachments to /dev/null and I diked out the code that puts the URLs in the e-mail. In master.cf, I add '-o content_filter=detach' to the SMTP service, and add the detach service further down in master.cf. detach unix - n n - - pipe flags=Rq user=list argv=/usr/local/bin/detachit $(sender) $(recipient) The detachit script file is pretty simple. It handles piping the message to the detach script, and then taking the result and pushing it back to the sendmail command for final delivery. #!/bin/sh # # detachit: Pipe postfix messages through detach # sender=$1 shift recip="$@" if [ "$#" -eq 1 ]; then /usr/local/bin/detach -d /var/www/webmail/detach --aggressive -w https://enamel.welovesmiles.com/detach else /usr/local/bin/detach -d /var/www/webmail/detach --aggressive -w https://enamel.welovesmiles.com/detach fi | /usr/sbin/sendmail -i -f $sender -- $recip exit $? Hope that helps. -A