Use Telnet to Test a Mail Server
If you have a SMTP email server and you want to test if it is working properly, you can following the steps below to test it.
user_name@myhost:~$ telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 myhost ESMTP Sendmail 8.14.3/8.14.3/Debian-9ubuntu1; Sat, 16 Jan 2010 17:28:30 -0800; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
HELO myhost
250 myhost Hello localhost [127.0.0.1], pleased to meet you
MAIL FROM:
250 2.1.0
RCPT TO:
250 2.1.5
DATA
354 Enter mail, end with "." on a line by itself
Subject: Test
Test
Test
Test
.
250 2.0.0 o0H1SUjV016265 Message accepted for delivery
quit
221 2.0.0 npu40 closing connection
Connection closed by foreign host.
user_name@myhost:~$
If you can receive the above email properly, it means you can send email from the localhost. Next step, you can try to telnet it external IP address, like 192.168.0.123, to check if it can relay emails through the external IP address.