Thursday, December 29, 2011

How to send mails using telnet


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 25
Connected to localhost.localdomain (
Escape character is '^]'.
220 ESMTP Sendmail 8.13.8/8.13.8; Fri, 30 Dec 2011 04:04:06 +0530
250 Hello localhost.localdomain [], 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
354 Enter mail, end with "." on a line by itself
hi test1
250 2.0.0 pBTMY6ln018613 Message accepted for delivery
221 2.0.0 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=<>, proto=SMTP, daemon=MTA, relay=localhost.localdomain []
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

No comments:

Post a Comment

Be nice. That's all.