[Mutt] Block, autoreplay and purge messages with attachement size large than 1MB

Mihai Lazarescu mtlagm at gmail.com
Thu May 28 00:46:29 UTC 2020


On Wednesday, May 27, 2020 at 16:59:20 -0300, Marcelo Laia wrote:

> Please, is there a way for me to configure offlineimap, msmtp 
> and mutt to:
>
> 1. to check if the message has an attachment
>
> 2. to check the attachment size
>
> 3. If the attachment is larger than 1MB, send a message with the
> following text: "Dear colleague, your message has not been delivered. My
> system has detected that it contains attachments larger than 1MB. It wa
> blocked! Please upload the attachment in the cloud ( drive, dropbox,
> onedrive, etc.) and send me the message again with the link to download
> the attachment. Thank you very much! "
>
> 4. Purge the message from my local and remote dir
>
> Is there a way to implement this?

You can do it by hand:

- connect mutt directly to your Gmail folder that you want to clean
- sort the messages by size (most size will be due to attachment)
- pipe all messages above a threshold to a script which prepares 
and sends the reply
- delete the messages

Probably this can be automated, at least to some extent.

I prefer to save the attachments on disk, then and delete them 
from the messages. Later on I can still see the name of the 
deleted attachment file in the messages, then I can quickly find 
the detached file using locate.

Best,
Mihai


More information about the Mutt-users mailing list