SMTP
Enumerate SMTP users and send mail from the command line.
SMTP relays mail on 25/TCP. The protocol carries user-verification commands and accepts messages from any client the server policy allows.
Enumeration
NMAP
nmap -p25 --script smtp-enum-users <IP> -vMetasploit
VRFY and EXPN responses may reveal accounts, but servers can disable these
commands or give noncommittal answers. The Metasploit module
auxiliary/scanner/smtp/smtp_enum tests a username wordlist; a negative response
does not prove the account is absent.
Sending email from the CLI
Swaks
swaks --to recipient@example.org --from sender@example.org --header "Subject: SMTP test" --body "Delivery test" --server <IP>Acceptance by the relay does not prove final delivery or an open relay. Ports 587 and 465 commonly require submission-specific authentication and TLS.
Python
Python STARTTLS submission example
Use a server that supports STARTTLS. This sends a plain test message, not an executable payload.
from email.message import EmailMessage
import smtplib
import ssl
msg = EmailMessage()
msg["From"] = "sender@example.org"
msg["To"] = "recipient@example.org"
msg["Subject"] = "SMTP test"
msg.set_content("Delivery test")
with smtplib.SMTP("<SMTP_HOST>", 587, timeout=10) as server:
server.starttls(context=ssl.create_default_context())
# Authenticate here if required by the submission service.
server.send_message(msg)Provenance and confidence
- Version
- 2
- Sources reviewed
- 2026-11-23
- Confidence
- medium — Legacy RTFM; v2 editorial review on 2026-11-23 replaces unrelated mail payload code with plain delivery examples and qualifies enumeration/delivery conclusions. No mail sent.
Also searched as: smtp, énumération smtp, swaks, vrfy, 25/tcp