How can I send an email through the UNIX mailx command?

an example

$ echo "something" | mailx -s "subject" recipient@somewhere.com

to send attachment

$ uuencode file file | mailx -s "subject" recipient@somewhere.com

and to send attachment AND write the message body

$ (echo "something\n" ; uuencode file file) | mailx -s "subject" recipient@somewhere.com

Leave a Comment