Thursday, December 29, 2011

How to send mails using telnet

Sponsored Links
This post explains how to send mails to the users in the same system. From the user aswath to the user ajith. This is useful to troubleshoot mail server issues.

[root@localhost ~]# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 localhost.localhost.com ESMTP Sendmail 8.13.8/8.13.8; Fri, 30 Dec 2011 04:04:06 +0530
helo 127.0.0.1
250 localhost.localhost.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
mail from:<aswath@localhost.localdomain>
250 2.1.0 <aswath@localhost.localdomain>... Sender ok
RCPT TO:<ajith@localhost.localdomain>
250 2.1.5 <ajith@localhost.localdomain>... Recipient ok
data
354 Enter mail, end with "." on a line by itself
subject:test1
hi test1
.
250 2.0.0 pBTMY6ln018613 Message accepted for delivery
quit
221 2.0.0 localhost.localhost.com closing connection
Connection closed by foreign host.
You have new mail in /var/spool/mail/root
[root@localhost ~]#

The mail log is as follows.

[root@localhost ~]# tail -f /var/log/maillog
Dec 30 04:05:02 localhost sendmail[18613]: pBTMY6ln018613: from=<aswath@localhost.localdomain>, size=23, class=0, nrcpts=1, msgid=<201112292234.pBTMY6ln018613@localhost.localhost.com>, proto=SMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 30 04:05:02 localhost sendmail[18615]: pBTMY6ln018613: to=<ajith@localhost.localdomain>, ctladdr=<aswath@localhost.localdomain> (501/501), delay=00:00:38, xdelay=00:00:00, mailer=local, pri=30380, dsn=2.0.0, stat=Sent
Sponsored Links

No comments:

Post a Comment

Be nice. That's all.