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.
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 firstname.lastname@example.org
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.
I went to the /etc/exim4/exim.conf file and added the following line
MESSAGE_SIZE_LIMIT = "10000M"
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
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.