Command Line Sending Mails

Send email through telnet command-line

First you have to check if is any software listening at your 25 port

netstat -an | grep 25
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 192.168.13.66:42542         192.168.13.68:5002          ESTABLISHED
unix  3      [ ]         STREAM     CONNECTED     23225807
unix  3      [ ]         STREAM     CONNECTED     23225806
unix  2      [ ]         DGRAM                    23225802
unix  3      [ ]         STREAM     CONNECTED     19125  /var/run/pcscd.comm

Now you can connect and type your dialog commands:

-sh-3.1$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Thu, 9 Sep 2010 11:46:23 +0200
HELO server.com
250 localhost.localdomain Hello jost [127.0.0.1], pleased to meet you
MAIL FROM:usertest@localhost
250 2.1.0 usertest@localhost... Sender ok
RCPT TO:recipient@gmail.com
250 2.1.5 recipient@gmail.com... Recipient ok (will queue)
DATA
354 Enter mail, end with "." on a line by itself
SUBJECT:test 1 gmail
test one
.
250 2.0.0 o899kNjx020089 Message accepted for delivery
quit
221 2.0.0 localhost.localdomain closing connection
Connection closed by foreign host.

Now you can check the maillog events to check the accepted state: