* Sergey Poznyakoff <g...@gnu.org.ua> [2020-11-15 23:47]: > Jean Louis <bugs@gnu.support> ha escrit: > > > Is there any way in GNU Mailutils? > > No, I'm afraid there isn't any.
I am trying something like this below, but there may be bug, I will make it soon. save-attachments.sh: #!/bin/bash # This should be executed in ~/Maildir/per...@example.com for filename in "$1"; do REALPATH=`realpath "$filename"`; DIRNAME=`dirname $REALPATH`; EMAILDIR=`dirname $DIRNAME`; EMAILDIR=`basename $EMAILDIR`; echo $EMAILDIR; extract-attachments.pl $EMAILDIR < "$filename" > "$filename".LCK && mv -v "$filename".LCK "$filename"; done extract-attachments.pl: #!/usr/bin/perl -w # https://unix.stackexchange.com/questions/174707/remove-delete-attachments-from-email-server-imap#174726 # for filename in <list> # do # ./strip.pl em...@example.com < "$filename" > "$filename".lock && mv "$filename".lock "$filename" # rm "$filename".lock # done use strict; use Mail::Audit; use Mail::Audit::Attach qw(Attach); unless($ARGV[0]) { print "Specify email address on the command line.\n"; exit; } my $mail = Mail::Audit->new; my $attachments = $mail->attachments; my $download = "/home/admin/attachments/" . $ARGV[0] . "/"; mkdir $download; foreach (@$attachments) { $_->save($download); $_->remove; } $mail->print();