How to attach large files to command line email


Exim4 is the mail transfer agent that I am using on this Ubuntu machine. I was unable to find a way to attach a compressed file when sending an email using the mail command.

Of course you can pump a text file into the message using < but that just inserts the contents of the file literally inside the message.

Mutt to the rescue

I installed Mutt using the Synaptic Package Manager and ran a test. Basically the command looked something like this.

mutt -s "Backup of data" -a file_name

This worked really well… until I realized that there is a limit to the file size you are able to attach. This turned out to be a exim4 setting rather than a Mutt setting.

Increasing the message size limit

I went to the /etc/exim4/exim.conf file and added the following line


The default is 50M, not very big enough for the huge tar.bz2 files that I will be sending.

After making this change I had to run the following command

sudo update-exim4.conf

Word of warning

By opening the message size limit too large you are pretty much allowing any size email to come in, this may mean that your mail server could clogged up say in the case of a DOS attack. In my case this is a private machine address behind a gateway and does not receive any mail so this is not a concern to me.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s