Someone in this thread mentioned using "socat - tcp:host:port" as a
replacement for "telnet host port" for manually testing plaintext
services.

I just tried this, and learned that the two are not equivalent.
qpsmtpd is quite insistent that all of its input lines be terminated
by CR-LF, not by LF.

===============================================================
hobbit:~$ socat - tcp:localhost:25
220 greg.wooledge.org ESMTP qpsmtpd 1.00 ready; send us your mail, but not your 
spam.
HELO WORLD
250 greg.wooledge.org Hi localhost [127.0.0.1]; I am so happy to meet you.
MAIL FROM:<[email protected]>
250 <[email protected]>, sender OK - how exciting to get mail from you!
RCPT TO:<[email protected]>
250 <[email protected]>, recipient ok
DATA
354 go ahead
From: Greg
To: Greg
Subject: hi

hi
.
421 See http://smtpd.develooper.com/barelf.html
===============================================================

telnet does not have that problem.

So, I searched through the manual a bit more, and it turns out there's
an option for that:

===============================================================
hobbit:~$ socat - tcp:localhost:25,crnl
220 greg.wooledge.org ESMTP qpsmtpd 1.00 ready; send us your mail, but not your 
spam.
HELO WORLD
250 greg.wooledge.org Hi localhost [127.0.0.1]; I am so happy to meet you.
MAIL FROM:<[email protected]>
250 <[email protected]>, sender OK - how exciting to get mail from you!
RCPT TO:<[email protected]>
250 <[email protected]>, recipient ok
DATA
354 go ahead
From: Greg
To: Greg
Subject: hi
Date: Wed, 08 Jul 2026 13:47:36 -0400

hi
.
250 Queued! 1783534744 qp 143613 <>
===============================================================

Anyone looking to replace telnet with socat for this purpose will probably
need to use that option, on some or all services.

Reply via email to