SMTP - Simple Mail Transfer Protocol
The Simple Mail Transfer Protocol (SMTP) consists of successively executed commands, each of which is answered by the server with a status code.
The status code always follows a human-readable description, but it is irrelevant to the protocol.
Ports
| Port | Description |
|---|---|
| 25/tcp | SMTP |
| 587/tcp | SMTP Secure (STARTTLS) |
Status Codes
| Status Code | Description |
|---|---|
| 2xx | Success |
| 3xx | Missing Information |
| 5xx | Error |
If the status code and description are linked by a minus sign, this means that the output of the server is not yet finished. If the code is followed by a space, the server waits for the next command.
Commands
| Command | Description |
|---|---|
| HELO / EHLO (Enhanced HELO) | HELO / EHLO starts a "conversation" with the server. EHLO is the modern version supporting Authentication and Encryption. |
| AUTH PLAIN | Starts PLAIN-Authentication |
| AUTH LOGIN | Starts LOGIN-Authentication |
| MAIL FROM: | Sender Email Address (mandatory) |
| FROM: | Sender Name (String, not mandatory) |
| RCPT TO: | Recipient Email Address (mandatory) |
| TO: | Recipient Name (String, not mandatory) |
| SUBJECT: | Main Subject (String, not mandatory) |
| DATA | Message Body / Text |
| QUIT | Ends a session |
Sending a Mail
Minimum required information
EHLO`_systemname of sender`_
mail from:`_senders email address`_
rcpt to:`_recipient mail address`_
data
From:`_sender name (string)`_
To:`_recipient name (string)`_
Subject:`_Subject text (string)`_
text body
.
Authentication
The normal SMTP protocol without ESMTP extension does not support any authentication at all. Nowadays this is due to the spam problematics unfortunately usually no longer bearable.