Send e-mail with attachment from command line

mpack is a command line tool that can send e-mail with MIME formatted attachment.

mpack -a -s "My subject

From: Sender<>" -d messagebody.txt attachment.file

Since mpack accepts linebreaks in the -s option (which is actually ment to set the subject line) we can include other headers right after it. Just like I did in my example.

One note though is that you can add CC and BCC in the messageheader and make it appear that there are other recipients of the mail, but the message won’t be sent to those addresses.

This has been tested on mpack version 1.6

One Comment

  1. wook 4. October 2012