Ways to test sending email from the command line

Through a telnet connection

Start a telnet session with something like telnet localhost 25

ehlo localhost
mail from: root@localhost
rcpt to: username
data
Subject: A test mail through telnet

Is this working, you think?

Root
.

With a mailx

$ echo "The body of the mail" | mailx -s "the subject of the mail" someone@example.com

Sources