Skip Menu |

This queue is for tickets about the libnet CPAN distribution.

Report information
The Basics
Id: 109881
Status: open
Priority: 0/
Queue: libnet

Owner: Nobody in particular
Requestors: hesco [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: Net::SMTP gives me: warning: non-SMTP command
Date: Sat, 28 Nov 2015 10:09:53 -0500
To: bug-libnet [...]
From: Hugh Esco <hesco [...]>
root@mail:~# grep -i version /usr/share/perl/5.18.2/Net/ use vars qw($VERSION @ISA); $VERSION = "2.31"; root@mail:~# dpkg -l | grep postfix ii postfix 2.11.0-1 amd64 High-performance mail transport agent I have been using my script at: /root/lib/perl/ to validate my mail configuration for a couple of years now. This is the first time I have ever encountered this issue. Although the $smtp->hello() call was added while debugging this issue. When running the (slightly sanitized) script below at localhost on a postfix mail server configured as my network's mail relay, I see this in the logs: Nov 28 09:32:46 mail postfix/smtpd[24802]: warning: non-SMTP command from localhost[]: To: This however, got my message successfully relayed to its intended recipient: mailx -r I have not dug into the code to learn what might be at play that would generate this error. But I did find this documentation on the postfix site: Non-SMTP command test Some spambots send their mail through open proxies. A symptom of this is the usage of commands such as CONNECT and other non-SMTP commands. Just like the Postfix SMTP server's smtpd_forbidden_commands feature, postscreen(8) has an equivalent postscreen_forbidden_commands feature to block these clients. postscreen(8)'s deep protocol test for this is disabled by default. With "postscreen_non_smtp_command_enable = yes", postscreen(8) detects zombies that send commands specified with the postscreen_forbidden_commands parameter. This also detects commands with the syntax of a message header label. The latter is a symptom that the client is sending message content after ignoring all the responses from postscreen(8) that reject mail. This test is opportunistically enabled when postscreen(8) has to use the built-in SMTP engine anyway. This is to make postscreen(8) logging more informative. When a client sends non-SMTP commands, postscreen(8) logs this as: NON-SMTP COMMAND from [address]:port after command: text Translation: the SMTP client at [address]:port sent a command that matches the postscreen_forbidden_commands parameter, or that has the syntax of a message header label (text followed by optional space and ":"). The "after command" portion is logged with Postfix 2.10 and later. The postscreen_non_smtp_command_action parameter specifies the action that is taken next. See "When tests fail after the 220 SMTP server greeting" below. ----- #!/usr/local/bin/perl -w use Net::SMTP; $smtp = Net::SMTP->new('localhost'); $smtp->mail(''); $smtp->hello(''); $smtp->to(''); $smtp->data(); $smtp->datasend("To: mailto:check-auth2\\n"); $smtp->datasend("Subject: test dkim and spf with port25 tool\n"); $smtp->datasend("\n"); $smtp->datasend("Test dkim and spf\n"); $smtp->dataend(); $smtp->quit; -- Hugh Esco <>
Download (untitled) / with headers
text/plain 280b
Show quoted text
> $smtp->datasend("To: mailto:check-auth2\\n");
Pretty sure that the reason is that "mailto:check-auth2\" is not a valid email address. I would bet that this works without issue: $smtp->datasend("To: check-auth2\\n");
Download (untitled) / with headers
text/plain 709b
Did some experimenting, and it turns out the actual cause is the use of the hello() method, which isn't supposed to be called manually. This works as expected, although the recipient address is also mangled. It ends up as "mailto:check-auth2" which is likely undeliverable. ----- #!/usr/local/bin/perl -w use Net::SMTP; $smtp = Net::SMTP->new('localhost'); $smtp->mail(''); $smtp->to(''); $smtp->data(); $smtp->datasend("To: mailto:check-auth2\\n"); $smtp->datasend("Subject: test dkim and spf with port25 tool\n"); $smtp->datasend("\n"); $smtp->datasend("Test dkim and spf\n"); $smtp->dataend(); $smtp->quit;

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to