Use Telnet to Test SMTP
Okay, sometimes I forget the exact syntax and need to look this up from time to time. Hope this can help me search it quicker in the future. 🙂
Firstly, make sure you have telnet enabled or installed. Or you have a tool that is able to telnet. Next, make sure you have the relevant information needed to test the connector. I will list the main ones here:
- Network connectivity to the host.
- <$hostname>: this can be
internal name, FQDN, IP address, etc. of the SMTP host/server - <$SenderEmail>:
Email address you will besending from - <$RecipientEmail>:
Email address you will be sending to - <$Subject>: Test subject or anything you want (i think this is optional)
- <$Body>: This will be the body of the email
*Okay, one annoying thing about doing it this way is that you cannot use the backspace. If you use the backspace and it gives an error after you return, just type the command again without making a mistake.
- Open a command prompt (windows key+r, then type “cmd” and enter)
- type “telnet” then enter
- Type “set logfile <filename>” and press enter if you want a log of this session.
- This is optional but a good thing to do. It can be an existing directory and file name as well, or it will just go to the current directory.
- This is optional but a good thing to do. It can be an existing directory and file name as well, or it will just go to the current directory.
- Type “OPEN <$hostname> 25” and press enter
- the “25” represents the port that the SMTP service is running on. 25 is the
default, but can be 587 or whatever it’s configured as.
- the “25” represents the port that the SMTP service is running on. 25 is the
- Type “EHLO <$hostname>” and enter
- Type “MAIL FROM:<$SenderEmail>” and press enter
- Type “RCPT TO:<$RecipientEmail> NOTIFY=success,failure” and press enter
- Type “DATA” and press enter
- Type “Subject:<$Subject>” and press enter
- Press enter again
- Type “<$Body>” and enter
- Type a period (.), then press enter
- The period tells the server that you are done with the body and goes back into command mode
- Type “Quit” and enter to disconnect from the SMTP server
- Type “Quit” then enter to end your telnet session
- Alternatively, you can compose more tests, but to end your session, you need to type quit to exit Telnet.