Sending Email Attachments with Linux
Feb 18
In the past I’ve always wondered how to send email attachments from the command line on Linux. I used to be able to email text based files using the mail command:
mail user@domain.com < yourfile.txt
This is useful but actually embeds the text into the body of the email. I recently learned how to send this text as an attachment using the mutt command. The syntax looks like:
mutt -a yourfile.txt user@domain.com < /dev/null
The body text can be imported from an external file and in this case I’m telling it not to send any body text using /dev/null.
This might not be the only way to send attachments from the command line so if you know of any other approaches then please feel free to post them!
