From: "Lucian on
Hello,

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?

Thank you,

Lucian

From: Michal Kurka on
Dne 14.12.2009 v 09:16 Lucian @ lastdot.org napsal(a):

> 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 use:
postfix content_filter -> my shell-script -> ripmime -> postfix-sendmail

Programm 'ripmime' split mail into files - one file is one MIME-part
(plain text body, attachments files,...).
But for only delete attachments maybe there is exists more elegant and
simpler method (programm) than with 'ripmime'.

--
Michal Kurka - Mysak
sluzby spojene s operacnim systemem Linux

From: "Aaron C. de Bruyn" on
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

From: "Lucian on
On Mon, Dec 14, 2009 at 9:48 AM, Aaron C. de Bruyn
<postfix-users(a)darkpixel.com> wrote:
> 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
>

Thanks for your replies, detach seems to be close to what I want.
Aaron, any chance you can release your customizations to detach?


Regards,

Lucian

From: Stan Hoeppner on
Lucian @ lastdot.org put forth on 12/14/2009 1:16 AM:
> Hello,
>
> 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?

Does this server receive email from the internet? Do you want to strip
attachments from both inbound and outbound email or just inbound email?
The solution may vary, or require two separate solutions, depending on
the answers to these questions. The solution may also vary depending on
whether this is a relay/gateway server or one that delivers mail to
local maildirs or to a local IMAP server such as dovecoat.

We need more details before we can steer you in the correct direction.
For instance, if you deliver mail locally to dovecoat, and you only want
to strip attachments from inbound mail, you can do this within dovecoat.
If this is a gateway/relay only Postfix server, you will likely have to
implement inbound and outbound policy filters for stripping the attachments.

--
Stan