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

user269484 picture user269484 · Feb 17, 2010 · Viewed 655.3k times · Source

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

Answer

ghostdog74 picture ghostdog74 · Feb 17, 2010

an example

$ echo "something" | mailx -s "subject" [email protected]

to send attachment

$ uuencode file file | mailx -s "subject" [email protected]

and to send attachment AND write the message body

$ (echo "something\n" ; uuencode file file) | mailx -s "subject" [email protected]