smtpSimple Mail Transfer ProtocolMail Relay Conversations (mta1 <-> mta2 smtp: EHLO -> MAIL FROM -> DATA)
What It Does on the Wire
Step through a real RFC 5321 mail relay (220 greeting -> ehlo -> mailfrom -> rcptto -> 354 -> body -> 250 OK) over stateful TCP 25 to test mail-gateway DLP and open-relay signatures.
Simple Mail Transfer Protocol (smtp, RFC 5321) relays email between Mail Transfer Agents (MTAs) on TCP port 25 and mail submission gateways on TCP port 587. An SMTP envelope steps through server 220 greeting -> client EHLO -> MAIL FROM:<...> -> RCPT TO:<...> -> DATA (354) -> RFC 5322 message body -> 250 acceptance -> QUIT (221).
FrameAssembly gives you clean keywords for every envelope command (ehlo, helo, mailfrom, rcptto, data, quit, or custom cmd) plus code / reply for server responses and body for message content.
Test Rogue Internal Spambot & Port 25 Egress Blocks
Verify that workstation VLANs are blocked from sending direct TCP 25 SMTP traffic except through your approved Secure Email Gateway.
Validate Phishing Header, Sender Spoofing & DLP IDS Signatures
Build a full SMTP conversation (ehlo -> mailfrom -> rcptto -> data -> body) to test Suricata smtp rules and Zeek smtp.log extraction safely.
Open-Relay Rejection (code 550) Troubleshooting
Capture code 550 reply "5.7.1 Relaying denied" responses to test alerting on unauthorized mail relay attempts.
Minimal Quickstart (smtp_quickstart.frasm)
Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.
host app_srv { ip 10.20.10.15 }host mail_gw { ip 10.20.10.25 }compile { app_srv -> mail_gw tcp syn srcport 51025 dstport 25 wait 1ms app_srv <- mail_gw tcp syn ack wait 1ms app_srv -> mail_gw tcp ack wait 1ms app_srv <- mail_gw smtp code 220 reply "mx01.corp.internal ESMTP Postfix" wait 2ms app_srv -> mail_gw smtp ehlo "app01.corp.internal" wait 2ms app_srv <- mail_gw smtp code 250 reply "mx01.corp.internal"}What the Compiler Calculates So You Don't Have To
- Defaults to TCP destination port
25(psh ack; usedstport 587for submission) and terminates SMTP lines with. - Formats
MAIL FROM:<...>(mailfrom) andRCPT TO:<...>(rcptto) cleanly and terminatesbodypayloads with.when needed. - Tracks TCP sequence and acknowledgment numbers automatically across the full multi-step envelope.
Complete End-to-End RFC 5321 Email Delivery Transaction
Walks through a full TCP 25 session from 220 banner and EHLO through MAIL FROM, RCPT TO, DATA (354), message headers/body, 250 Queued, and QUIT.
host alert_bot { ip 172.16.15.20 }host smtp_relay { ip 172.16.15.25 }compile { alert_bot -> smtp_relay tcp syn srcport 52025 dstport 25 win 65535 mss 1460 wait 1ms alert_bot <- smtp_relay tcp syn ack win 65535 mss 1460 wait 1ms alert_bot -> smtp_relay tcp ack wait 1ms alert_bot <- smtp_relay smtp code 220 reply "relay.corp.internal ESMTP" wait 2ms alert_bot -> smtp_relay smtp ehlo "alert-bot.corp.internal" wait 1ms alert_bot <- smtp_relay smtp code 250 reply "PIPELINING" wait 1ms alert_bot -> smtp_relay smtp mailfrom "<noc-alerts@corp.internal>" wait 1ms alert_bot <- smtp_relay smtp code 250 reply "2.1.0 Ok" wait 1ms alert_bot -> smtp_relay smtp rcptto "<oncall@corp.internal>" wait 1ms alert_bot <- smtp_relay smtp code 250 reply "2.1.5 Ok" wait 1ms alert_bot -> smtp_relay smtp data wait 1ms alert_bot <- smtp_relay smtp code 354 reply "End data with <CR><LF>.<CR><LF>" wait 2ms alert_bot -> smtp_relay smtp body "Subject: Core Link Down\r\nFrom: noc-alerts@corp.internal\r\n\r\nGi1/0/49 went down.\r\n." wait 2ms alert_bot <- smtp_relay smtp code 250 reply "2.0.0 Ok: queued as 9F4A1" wait 1ms alert_bot -> smtp_relay smtp quit wait 1ms alert_bot <- smtp_relay smtp code 221 reply "2.0.0 Bye"}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show smtp_full_envelope.frasm
# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly smtp_full_envelope.frasm smtp_full_envelope.pcap
frameassembly smtp_full_envelope.frasm smtp_full_envelope.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse smtp_full_envelope.pcap smtp_full_envelope_edited.frasmAll smtp Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after smtp:
src_host -> dst_host smtp [ehlo ["<domain>"] | helo ["<domain>"] | mailfrom "<addr>" | rcptto "<addr>" | data | quit | cmd "<verb>" [param "<text>"]] [code <200..599>] [reply "<text>"] [body "<text>"]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| ehlo ["<domain>"] | helo ["<domain>"] | Extended or classic SMTP greeting + client hostname | "localhost" | Writes EHLO <domain>
or HELO <domain>
. |
| mailfrom "<addr>" | rcptto "<addr>" | Quoted sender or recipient email address | Omitted unless set | Writes MAIL FROM:<addr>
or RCPT TO:<addr>
. |
| data | quit | cmd "<verb>" [param "<text>"] | Envelope command or custom verb (e.g. cmd "STARTTLS") | Omitted | Writes DATA
, QUIT
, or <verb> <param>
. |
| code <200..599> [reply "<text>"] | 3-digit SMTP reply code (220, 250, 354, 421, 550) + text | Omitted on client commands | Emits a server reply line (250 2.0.0 Ok
). |
| body "<text>" | Quoted RFC 5322 email headers + message body | Empty | Transmits the email message payload following 354 DATA acceptance. |
Cross-Layer Wrappers Valid with smtp
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
11 options
Cross-Layer Wrappers Valid with smtp
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | Colon, hyphen, or Cisco dot MAC | Host MAC / RFC multicast MAC | Overrides the 14-byte Ethernet II source or destination MAC address for this single packet. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255 | Unlabeled (at most 1 mpls tag per packet) | Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header. |
| ttl <0..255> [dscp <0..63>] [ecn <0..3>] | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | ttl 64, dscp 0, ecn 0 | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| ipid <0..65535> [df] [mf] [fragoffset <0..8191>] | IPv4 ID, DF/MF flags, fragment offset 0..8191 | ipid 1, flags 0, fragoffset 0 | Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6). |
| flowlabel <0..1048575> | 20-bit IPv6 Flow Label (0..1048575) | 0 | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts). |
| srcport <0..65535> | dstport <0..65535> | Port number 0..65535 | srcport 49152 (remembered), TCP 25 (or dstport 587 Submission) | Overrides source or destination port and remembers the port pair automatically on <- replies. |
| seq <number> | acknum <number> | win <0..65535> | syn | ack | psh | fin | rst | TCP sequence/ack numbers, window size, flags & RFC 7323 options | psh ack, win 65535, automatic TCP seq/acknum | Overrides automatic TCP sequence tracking, flags, or RFC 7323 options (mss, wscale, sackperm, tsval, tsecr). |
Gotchas & Quick Fixes
No Spaces or Underscores in mailfrom and rcptto
alert_bot -> smtp_relay smtp mail_from "<a@b>" rcpt_to "<c@d>"alert_bot -> smtp_relay smtp mailfrom "<a@b>"Send mailfrom and rcptto on separate packet lines (one SMTP command per packet, spelled with zero underscores).