Using mpack to send email attachments from command line

In this post, we will learn a simple way of sending an email with attachment from the Linux terminal using mpack.

mpack encodes the named file in one or more MIME messages and sends the message to one or more recipients, or writes it to a named file or set of files.

To send a message with an attachment, we run the following command:

$ mpack -s "subject" <filename> user@mail.address