DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Mail A File As An Attachment From The UNIX Prompt
uuencode file.txt file.txt | mail email@address.com






Comments
Snippets Manager replied on Fri, 2007/04/13 - 11:44am
mutt -s "This a subject" \ -a Attached_File.txt \ recipient@email.com < Email_Body.txtWith mutt, you can add many attachments (not sure if there is a limit) and you don't have to mess with uuencode and mailx. Attachments are attached as one would expect. This functionality can be wrapped easily in a script that so that you can make use of environment/script variables for the arguments.Snippets Manager replied on Mon, 2012/05/07 - 2:14pm
mime-construct \ --to "person@example.com" \ --subject "Your computer" \ --string "Your computer is on fire" \ --type text/plain --file-attach extinguishing_howto.txt