"EHLO localhost" is command you write when connected to Postfix via telnet or
nc (netcat). I use nc instead of telnet, like this:
nc localhost 25
This command connects you to your mail server. When connected, you start a
sort of conversation with you mail server. The server says something, then
you, then the the server, and so on.
When you connect the server first says:
220 trisquel ESMTP Postfix (Ubuntu)
This is basically a greetings from the server, introducing itself and telling
you that it's running fine. Now you can respond with something the server
understands. You can write something like this in nc and press enter (new
line):
EHLO localhost
This is you, introducing yourself to the server by saying "HELLO" and that
you are "localhost". After this command, the server will respond back with
list of all of it capabilities. It might say something like this:
250-trisquel Hello localhost
250-SIZE 52428800
250-PIPELINING
250-STARTTLS
250-AUTH
250 HELP
This list tells what you can do with the server. If you see STARTTLS, this
means the server can START an ecrypted communication using TLS.
When you want to stop the communication with the server, you can write:
QUIT
The server will respond with something like:
221 trisquel closing connection
Then the communication will finish, nc will close and you'll be back in Bash.
Using this method you can also send messages, using the commands "MAIL FROM",
"RCPT TO" and "DATA". Like this:
220 libtec.org ESMTP Exim 4.76 Sun, 19 Jan 2014 13:41:47 +0200
MAIL FROM:<mampir@libtec,org>
250 OK
RCPT TO:<muhammed@localhost>
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
Hi, Muhammed!
.
250 OK
QUIT
221 libtec.org closing connection
Every lines starting with a number code, such as 250, is from the mail
server. These codes identify the different types of responses the server can
give. The codes are usually followed by more details.
Also, "EHLO" is used as a "HELLO" command, because there is an older command
called "HELO". The older one was more commonly used, before "EHLO" was
made-up.
Hope all this makes sense to you. :)