It's often handy to send email from the command line using mail, however it isn't very obvious how to attach files to the resulting email. To do it, you just require uuencode. In both Debian and Red Hat based distributions, this will be in the sharutils package.
To send attachment with the email run the following command:
(echo Email Body Text; uuencode ~/file1.zip file1.zip;) | mail -s "Email Subject" recipient@example.comThis will attach file1.zip to the email and send it to recipient@example.com.


Thunderbird picks up the attachment nicely. Pine or Mutt doesn't :-/
Steve,
Hadn't tried sending uuencoded messages to them before. However there is a way around it using mpack.
mpack -s "Subject" -d file.with.body -c application/octet-stream file.to.attach recipient@example.com
Cool. Cheers for the tip.
If mutt is configured, you can just:
echo 'The files are attached' | mutt -a filename -s 'Subject text here' recipient@example.com