Skip to content

Test Mail Server Status with TELNET

test smtp with telnet

1. Connect to the mail server using Telnet:

#telnet mail.server.com 25

Trying 192.168.33.11…
Connected to mail.server.com.
Escape character is ‘^]’.
220 ***

2.Greet the mail server

EHLO  mail.server.com

250- mail.server.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-XXXXXXXA
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

3. tell server that Authentication is required


The server should return (334 VXNlcm5hbWU6) i.e Username. This is a base 64 endode string asking for username. Copy and paste base64 encoded username and enter

AUTH LOGIN

334 VXNlcm5hbWU6

bWFuYWI=

4. After that the server should return (334 UGFzc3dvcmQ6) which means Password. Paste the base64 encoded password string and enter

334 UGFzc3dvcmQ6

bWFuYWI=

5. If password is OK we get Authentication Successful Message like below:

235 2.0.0 Authentication successful

6. Now to send a mail type send mail: with a email address:

mail from:notification.desk
250 2.1.0 Ok

7. Type the following command and the SMTP address that you want to send the email message to:

rcpt to:jyotim@gmail.com
250 2.1.5 Ok

8. Type the following command to tell the SMTP server that you are ready to send data

DATA

354 End data with <CR><LF>.<CR><LF>

(Enter Subject)

Subject: test mail

Press Enter two times. You do not receive a response from this command.

Note: The two Enter commands must comply with Request for Comments (RFC) 822 and 2822.

Type something  to add message body text. Type a period (.) at the next blank line, and then press Enter. You receive the following response:

Ok. this is a test mail from notification to test@gmail.com to check mail problem
.
250 2.0.0 Ok: queued as 6DEDE4501

9. quit
221 2.0.0 Bye
Connection closed by foreign host.

[root@Host1 ~]#


Command to encode / decode with base64:

perl -MMIME::Base64 -e 'print encode_base64("username");'

perl -MMIME::Base64 -e 'print encode_base64("password");'

or use some online tool. like: https://www.base64encode.org/