Geek Side Blog‎ > ‎Archives‎ > ‎

SMTP test with telnet

From time to time, it is handy to be able to test the ability of an email server to handle email as expected. Sometimes the best way is to directly interact with the email server itself.

To do that, you can use netcat, telnet or putty. Telnet is popular because it is already installed on most systems, but putty is very easy to use as well if you choose the telnet protocol and netcat (also nc) is often present on live (boot from CD or thumb drive) systems.

telnet 25
Subject: this is a test message

[Press Enter Twice]
Hello. This message was sent through the SMTP server directly.

See also:

Another example, this one for sending from a command line through sendmail:
echo "From: ${from}";
echo "To: ${to}";
echo "Subject: ${subject}";
echo "Content-Type: text/html";
echo "MIME-Version: 1.0";
echo "";
echo "${message}";
) | sendmail -t