Skip to content

Conversation

@arp242
Copy link
Contributor

@arp242 arp242 commented Jul 9, 2025

Strictly this isn't needed since client commands are in the form "verb arguments" and server replies are in the form "numeric-code text". But not everyone is intimately familiar with SMTP, and even if you are, IMHO the CLIENT/SERVER prefixes makes the output a lot easier to scan.

Full example:

220 smtp.fastmail.com ESMTP ready
EHLO localhost
250-smtp.fastmail.com
250-PIPELINING
250-SIZE 71000000
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 AUTH PLAIN LOGIN XOAUTH2 OAUTHBEARER
AUTH LOGIN QyxzeSdXKiJDMwo=
334 UGFzc3dvcmQ6
VEordkp6dEhYPAo=
235 2.0.0 OK
MAIL FROM:<[email protected]> BODY=8BITMIME
250 2.1.0 Ok
RCPT TO:<[email protected]>
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
From: [email protected]
To: [email protected]
Subject: test

Test
.
250 2.0.0 Ok: queued as 40BECEC0498 5F5864B5217 via phl-compute-03
QUIT
221 2.0.0 Bye

Becomes:

SERVER  220 smtp.fastmail.com ESMTP ready
CLIENT  EHLO localhost
SERVER  250-smtp.fastmail.com
SERVER  250-PIPELINING
SERVER  250-SIZE 71000000
SERVER  250-ENHANCEDSTATUSCODES
SERVER  250-8BITMIME
SERVER  250 AUTH PLAIN LOGIN XOAUTH2 OAUTHBEARER
CLIENT  AUTH LOGIN QyxzeSdXKiJDMwo=
SERVER  334 UGFzc3dvcmQ6
CLIENT  VEordkp6dEhYPAo=
SERVER  235 2.0.0 OK
CLIENT  MAIL FROM:<[email protected]> BODY=8BITMIME
SERVER  250 2.1.0 Ok
CLIENT  RCPT TO:<[email protected]>
SERVER  250 2.1.5 Ok
CLIENT  DATA
SERVER  354 End data with <CR><LF>.<CR><LF>
CLIENT  From: [email protected]
CLIENT  To: [email protected]
CLIENT  Subject: test
CLIENT
CLIENT  Test
CLIENT  .
SERVER  250 2.0.0 Ok: queued as 7899B14002F7 7BE7C338A76 via phl-compute-01
CLIENT  QUIT
SERVER  221 2.0.0 Bye

Strictly this isn't needed since client commands are in the form "verb
arguments" and server replies are in the form "numeric-code text". But
not everyone is intimately familiar with SMTP, and even if you are, IMHO
the CLIENT/SERVER prefixes makes the output a lot easier to scan.

Full example:

	220 smtp.fastmail.com ESMTP ready
	EHLO localhost
	250-smtp.fastmail.com
	250-PIPELINING
	250-SIZE 71000000
	250-ENHANCEDSTATUSCODES
	250-8BITMIME
	250 AUTH PLAIN LOGIN XOAUTH2 OAUTHBEARER
	AUTH LOGIN QyxzeSdXKiJDMwo=
	334 UGFzc3dvcmQ6
	VEordkp6dEhYPAo=
	235 2.0.0 OK
	MAIL FROM:<[email protected]> BODY=8BITMIME
	250 2.1.0 Ok
	RCPT TO:<[email protected]>
	250 2.1.5 Ok
	DATA
	354 End data with <CR><LF>.<CR><LF>
	From: [email protected]
	To: [email protected]
	Subject: test

	Test
	.
	250 2.0.0 Ok: queued as 40BECEC0498 5F5864B5217 via phl-compute-03
	QUIT
	221 2.0.0 Bye

Becomes:

	SERVER  220 smtp.fastmail.com ESMTP ready
	CLIENT  EHLO localhost
	SERVER  250-smtp.fastmail.com
	SERVER  250-PIPELINING
	SERVER  250-SIZE 71000000
	SERVER  250-ENHANCEDSTATUSCODES
	SERVER  250-8BITMIME
	SERVER  250 AUTH PLAIN LOGIN XOAUTH2 OAUTHBEARER
	CLIENT  AUTH LOGIN QyxzeSdXKiJDMwo=
	SERVER  334 UGFzc3dvcmQ6
	CLIENT  VEordkp6dEhYPAo=
	SERVER  235 2.0.0 OK
	CLIENT  MAIL FROM:<[email protected]> BODY=8BITMIME
	SERVER  250 2.1.0 Ok
	CLIENT  RCPT TO:<[email protected]>
	SERVER  250 2.1.5 Ok
	CLIENT  DATA
	SERVER  354 End data with <CR><LF>.<CR><LF>
	CLIENT  From: [email protected]
	CLIENT  To: [email protected]
	CLIENT  Subject: test
	CLIENT
	CLIENT  Test
	CLIENT  .
	SERVER  250 2.0.0 Ok: queued as 7899B14002F7 7BE7C338A76 via phl-compute-01
	CLIENT  QUIT
	SERVER  221 2.0.0 Bye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant