Il modo più semplice:usare uuencode (parte di sharutils pacchetto). Qualsiasi formattazione o corpo del testo non è disponibile. Solo un'email con allegato e oggetto personalizzato.
uuencode /path/to/file file_name.ext | mail -s subject [email protected]
 
 Il modo complesso:usare sendmail e formattazione html:
v_mailpart="$(uuidgen)/$(hostname)"
echo "To: [email protected]
Subject: subject
Content-Type: multipart/mixed; boundary=\"$v_mailpart\"
MIME-Version: 1.0
This is a multi-part message in MIME format.
--$v_mailpart
Content-Type: text/html
Content-Disposition: inline
<html><body>Message text itself.</body></html>
--$v_mailpart
Content-Transfer-Encoding: base64
Content-Type: application/octet-stream; name=file_name.ext
Content-Disposition: attachment; filename=file_name.ext
`base64 /path/to/file`
 --$v_mailpart--" | /usr/sbin/sendmail -t
 in caso di più allegati l'ultima parte può essere ripetuta.
 Con mutt invece di mail chiameresti semplicemente
echo "body" | mutt -s "subject" -a attachment0 attachment1 [...] -- [email protected]
 
 Qui, attachmentN sono l'elenco dei file che vuoi allegare.