If mailx is just not hardcore enough for you you have to do your SMTP via telnet.

In all seriousness though sometimes you do really want to walk though a SMTP session or validate a mail server. SMTP is a pretty simple Protocol and you can reasonable send simple emails using a Telnet client for testing.


Using a telnet client (Putty if you don’t have one) connect using telnet on port 25 (465, 587, and 525 will sometime also work)

You should see something like this

220 mx.invoke.coffee ESMTP Postfix # 220 Means that services is ready
mx.invoke.coffee # Is the name of the server
ESMTP # Means that is supports the extended SMTP Commands
Postfix # Is the type of mail server

As you can see this is really useful information But lets move on.

Say hello

EHLO hostname

(if you got SMTP and not ESMTP above use HELO

You should get back a bunch of information

EHLO andrew.com
250-SIZE 10240000
250 DSN

I won’t go into the meaning of this but this is used by the connecting server or client.

Sending Email

MAIL FROM Thisisnotreal@noone.com
RCPT TO: someomereal@invoke.coffee
From: Thisisnotreal@noone.com
Subject: Hi
To: someomereal@invoke.coffee
Helo someonereal
This is Thisisnotreal

Couple of notes here.

You will get responses back from the server after each command verifying what you are sending.

You must end with a . only this ends the DATA block.


Will end the session.

More information

Full command reference http://www.samlogic.net/articles/smtp-commands-reference.htm

SMTP reply codes http://www.greenend.org.uk/rjk/tech/smtpreplies.html

Last thoughts

Any public mail server that receives mail must have this available this is how email is sent. So don’t be concerned that this works on your mail server. if you are conserved look up securing mail servers and look at SFP records and using STARTTLS.