Email - Smtp Protocol


SMTP is a network protocol to send and receive mail between two hosts.

  • A MTA is a SMTP server
  • A MUA is a SMTP client

This page shows you the command and how you can interact with a SMTP server (MTA) in order to send an email

Example session

Step 1 - Connection

The first step is to connect to the SMTP server.

Without TLS

The port 25 is the default port of public server and should be configured without TLS

This port is normally only for receiving email but for test purpose on the localhost, it should be permitted to send an email.

Example with:

  • netcat
nc localhost 25
  • telnet
set localecho
set logfile c:\TelnetTest.txt
telnet localhost 25

With TLS

The submission port (ie where you can submit an email) is on:

  • 487 with SSL
  • and nowadays on 587 with TLS

Openssl has support for TLS over SMTP.

openssl s_client -connect -starttls smtp

Step 2 - Command

Server: Banner

After a successful connection, the SMTP server responds with a banner

220 ESMTP Postfix

Client: EHLO

The remote SMTP client may introduce itself by giving its fully qualified domain name with the EHLO command (Extended HELO)


Server: Configuration

The SMTP server answer by advertising its configuration
250-SIZE 10240000

Mail Creation

The SMTP command that defines the email and finish with a .

MAIL FROM:<[email protected]>
RCPT TO: <[email protected]> NOTIFY=success,failure
Subject: Test email

Body of the email




of the SMTP client, if one is available.

  • ETRN,
  • MAIL FROM, Identifies the sender
  • VRFY , verify the username exists on server
  • RCPT TO, Identifies the recepient
  • STARTTLS (used to tell the SMTP client that the SMTP server allows use of TLS. It takes no parameters. See Postfix - TLS (SSL) configuration)
  • DATA (identified start of the message ie followed by a the body email
  • SEND - send message to terminal
  • RSET - Reset, abort connection and discard info
  • NOOP - No operations, only elicits an OK from the server
  • TURN

Generally forbidden (smtpd_forbidden_commands)

  • GET,
  • POST


  • AUTH LOGIN (then username password)

Documentation / Reference

Powered by ComboStrap