Thursday, 12 March 2015

Sending mail via telnet

Sometimes, we may have to use telnet command to send mails via command line. This will help us to check whether mail server is working fine or not.

We can use following procedure:

The commands that has to typed in command line is highlighted using "red" fonts.

-----
[root@MANINMANOJ~]$ telnet 192.168.20.21 25
Trying 192.168.20.21...
Connected to 192.168.20.21 (192.168.20.21).
Escape character is '^]'.

220 TZDARHQ-MSX07.zain.co.tz Microsoft ESMTP MAIL Service ready at Thu, 12 Mar 2015 14:31:52 +0300

HELO local.maninmanoj.com
250 TZDARHQ-MSX07.zain.co.tz Hello [local.maninmanoj.com]

MAIL FROM:<maninmanoj@test.com>
250 2.1.0 Sender OK

RCPT TO:<testing@testing.com>
250 2.1.5 Recipient OK

DATA
354 Start mail input; end with <CRLF>.<CRLF>

SUBJECT:Test Mail
Hi This is Test mail from Manoj.
.   ------> USE A DOT HERE TO SEND
250 2.6.0 <56466626-3949-4cab-8712-2875ec105952@TZDARHQ-MSX07.zain.co.tz> Queued mail for delivery
quit
221 2.0.0 Service closing transmission channel
Connection closed by foreign host.
--------

The whole process is self explanatory, however the following are some point to note:
-----
telnet 192.168.20.21 25 ---> Syntax: telnet <IPADDRESS/HOSTNAME OF YOUR MAIL SERVER>  25

HELO local.maninmanoj.com   ----> This is a welcome message to the server as you are saying HELO to someone.

MAIL FROM:<maninmanoj@test.com> ----> This is the from address.

RCPT TO:<testing@testing.com> ---> Recipient address.
-----

Kool :)

No comments:

Post a comment

Note: only a member of this blog may post a comment.