Send mail with an zip attached from Mutt without prompt options?

Posted on

Problem :

I’m stucked when I’m trying send an email, using Mutt, but evry times that I run the script it prompt an menu with an verification. There is any way to bypass that verification or to inupt the option from the script without ask nothing?

#! /bin/bash

zip -r /home/user/folder/*.*
mutt -s "files[CONFIDENTIAL]" -a --
rm**strong text**

Solution :

If you don’t specify the body of the message in the command line, mutt will try to open your text editor so that you can enter it. If you specifically want to send an empty message, you can do it this way:

mutt -s "files[CONFIDENTIAL]" -a < /dev/null --

If it still shows a verification message, the problem may come from your .muttrc, and you may try the following:

mutt -s "files[CONFIDENTIAL]" -a -F /dev/null < /dev/null --

Unless your .muttrc defines a specific way of sending e-mail, for example if it contains something like:

set sendmail = "/usr/bin/msmtp -a you"

In this case, you may copy the interesting lines (all options that you want to use, such as set crypt_autoencrypt if your files are confidential) of your .muttrc into a separate configuration file, and replace -F /dev/null by -F ~/.yournewconfigurationfile.

Hope that helps!

Leave a Reply

Your email address will not be published. Required fields are marked *