--- title: "SMTP Commands" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/pentesting-smtp/smtp-commands.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/pentesting-smtp/smtp-commands.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0" --- # SMTP Commands SMTP is a text protocol. After the server greeting, a client normally sends `EHLO`; the server's multiline response advertises supported extensions. A basic mail transaction then uses `MAIL FROM`, one or more `RCPT TO` commands, and `DATA`.[[1]](#references) ## Core commands[[1]](#references) - **`EHLO `**: Identifies an Extended SMTP client and requests the server's extension list. - **`HELO `**: Legacy greeting used when ESMTP is unavailable. - **`MAIL FROM:`**: Starts a transaction and sets its envelope sender. This is not the message's `From:` header. - **`RCPT TO:`**: Adds one envelope recipient; repeat it for additional recipients. - **`DATA`**: Requests permission to transmit the message headers and body. A `354` reply means the client may send the content, terminated by a line containing only a dot. - **`RSET`**: Aborts the current transaction and clears its sender, recipients, and data without closing the SMTP connection. - **`VRFY `**: Requests confirmation that a string identifies a user or mailbox. Servers commonly disable useful responses to reduce enumeration. - **`EXPN `**: Requests expansion of a mailing list. Servers may disable it. - **`HELP [command]`**: Requests general or command-specific help. - **`NOOP`**: Requests a successful reply without changing transaction state. - **`QUIT`**: Ends the SMTP session. ## Common extensions - **`SIZE [bytes]`**: The server advertises its maximum accepted message size; the client may declare the planned message size on `MAIL FROM`.[[2]](#references) - **`AUTH `**: Starts SMTP authentication using a mechanism advertised in the `EHLO` response. Credentials are not necessarily encrypted, so negotiate TLS first unless the selected mechanism provides adequate protection.[[3]](#references) - **`STARTTLS`**: Requests an upgrade of the connection to TLS. After a successful TLS negotiation, the client sends `EHLO` again because the advertised extensions can change.[[4]](#references) The obsolete `TURN` command from RFC 821 reversed the client and server roles on an existing connection. RFC 5321 no longer defines it, so do not expect current servers to support it.[[1]](#references)[[5]](#references) For a shorter operator-oriented catalog of these commands, the original page used ServerSMTP's command overview.[[6]](#references) ## References - [1] [RFC 5321 - Simple Mail Transfer Protocol](https://www.rfc-editor.org/rfc/rfc5321.html) - [2] [RFC 1870 - SMTP Service Extension for Message Size Declaration](https://www.rfc-editor.org/rfc/rfc1870.html) - [3] [RFC 4954 - SMTP Service Extension for Authentication](https://www.rfc-editor.org/rfc/rfc4954.html) - [4] [RFC 3207 - SMTP Service Extension for Secure SMTP over TLS](https://www.rfc-editor.org/rfc/rfc3207.html) - [5] [RFC 821 - Simple Mail Transfer Protocol (obsolete)](https://www.rfc-editor.org/rfc/rfc821.html) - [6] [ServerSMTP - SMTP commands overview](https://serversmtp.com/smtp-commands/)