Tag Archives: SMTP

Send email via telnet

A quick way to test your SMTP server is to use telnet. The default well known port for SMTP is 25.

telnet mail.example.com 25
220 mail.example.com ESMTP Postfix (Ubuntu)
helo me.test.com
250 mail.example.com
mail from:me@here.com
250 2.1.0 Ok
rcpt to:you@there.com
250 2.1.5 Ok
data
354 End data with .
subject:a test

blah blah.
.
250 2.0.0 Ok: Queued as ABC123
quit
220 2.0.0 Bye

To use the labels, such as From, To, Subject, add them after the data command. i.e.

data

from:me@here.com
to:you@there.com
subject:testing again.

words
.
quit

There are other commands you can issue such as ehlo (extended helo) instead of helo. This will have the server list it’s capabilities. Other commands such as vrfy (verify and address) may have been disabled by the system administrator.

One of the inherent problems with email is it allows the sender to use arbitry information in the headers. Fake domain addresses and so on. The mail administrator may use a variety of techniques to block spam and otherwise unwanted mail from entering their systems but it’s an ongoing battle.