Sending email with attachment from command line

Recently I needed to send a script to one of my co-workers from the server. One way to do that is copy the script using scp to my PC and send it as usual. But there is a more efficient way to do that with mutt:

$ mutt -s "Subject" -a /tmp/file.tar.gz your@email.addr < /tmp/message-body.txt

I hope that all parameters are understandable. So, having mutt and using that command you can easily send email with attached file from command line.

Published by

Michael Stepanov

Site owner and admin :)

Leave a Reply

Your email address will not be published. Required fields are marked *