The SMTP Protocol

Card Puncher Data Processing

About

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 server.example.com:587 -starttls smtp

Step 2 - Command

Server: Banner

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

220 server.example.com ESMTP Postfix

Client: EHLO

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

EHLO client.example.com

Server: Configuration

The SMTP server answer by advertising its configuration

250-server.example.com
250-PIPELINING
250-SIZE 10240000
250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
...

Mail Creation

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

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

Body of the email
.

QUIT

QUIT

Command

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 (postconf.5.html)

  • CONNECT,
  • GET,
  • POST

Login:

  • AUTH LOGIN (then username password)

Documentation / Reference





Discover More
Card Puncher Data Processing
Email - Encryption

in Email Message can be encrypted using: (in transit and storage) (in transit and storage) (in transit) S/MIME is a long-standing protocol which allows encrypted and signed messages to...
Smtp Telnet Result
Email - How to verify your SMTP connection and parameters (TSL/SSL) with TELNET ?

An article showing how you can verify the smtp parameters with telnet. You must be in the possession of your smtp parameters. The best way is to use the smtp of your ISP because you will then have access...
Card Puncher Data Processing
Email - Mille and one way to send an email (professional and user)

Mille and one way to send an email. Emails delivered using the SMTP protocol are sent in units called envelopes. submission port Advanced mechanism. See A user can send an email with a client...
Card Puncher Data Processing
Email - Postfix

Postfix is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL), TLS The postfix installation install also an alias to the sendmail command line. Doc...
Card Puncher Data Processing
Email - on Linux

Linux runs a “locally configured” mailer daemon that doesn't route messages by default through the Internet but only copies messages to other users spool directories It is real SMTP-compliant email,...
Card Puncher Data Processing
Email server - The server that sends, received and process email

An email server is a generic name for a collection of email services such as SMTP, POP, .., this article groups all knowledge about what an email server is
Card Puncher Data Processing
How to send an email with SendMail ?

This article shows you how to send an email with sendmail. The sendmail command may be the original or the one provided with your SMTP server. This documentation was tested with the sendmail of the...
Oracle Entreprise Linux Dvd X86 Edelivery
Linux - Installation of OEL 5 Update 5 on VMWare 32-bit (x86) machine

This article is a step-by-step manual to install Oracle Entreprise Linux 5 on a . Download the Oracle Entreprise Linux 5 : Go to...
Card Puncher Data Processing
Network - Application layer (HTTP/HTTPS)

Application layer is the 7 layer of OSI model that contains all services/application that implements a functionality above the transport layer (TCP/UDP) They defined functionalities such as: data format...
Windows Network Protocol Sysinfo
Network - Communication Protocol

A protocol design: the interactions that may occurs between participant and states of this interactions (lifecycle) finite automata In an network, a protocol is the language description on how...



Share this page:
Follow us:
Task Runner