Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Net::SMTP - Connection to local MTA refused

by Robidu (Acolyte)
on Mar 07, 2017 at 08:41 UTC ( [id://1183821]=note: print w/replies, xml ) Need Help??


in reply to Re: Net::SMTP - Connection to local MTA refused
in thread Net::SMTP - Connection to local MTA refused

The point is that the connection attempt does show up in the logs, but beyond the connection being initiated, nothing more happens. I'm experiencing the same issues when I set SSL => 0 (this is still possible, because my MTA is configured so that TLS doesn't have to be used for incoming mails) so it's not a problem with SSL/TLS, though. As far as the form mailer is concerned, it is supposed to transmit its data on port 25. No idea why it stopped working after upgrading the distro...

However, I'm going to give the Debug approach a shot.

EDIT: It appears that STARTTLS is required, but the method starttls() seems to be missing in my Net::SMTP...

Anyway, here's what the script dumped with Debug enabled:

Sanity check of recipient address... <recipient address displayed here> Net::SMTP>>> Net::SMTP(2.31) Net::SMTP>>> Net::Cmd(2.29) Net::SMTP>>> Exporter(5.68) Net::SMTP>>> IO::Socket::INET(1.33) Net::SMTP>>> IO::Socket(1.36) Net::SMTP>>> IO::Handle(1.34) Net::SMTP=GLOB(0x1c9d748)<<< 220 <domain name displayed here> mail. Al +l spam is reported. ESMTP Net::SMTP=GLOB(0x1c9d748)>>> EHLO <domain displayed here> Net::SMTP=GLOB(0x1c9d748)<<< 250-<server name displayed here> Net::SMTP=GLOB(0x1c9d748)<<< 250-PIPELINING Net::SMTP=GLOB(0x1c9d748)<<< 250-SIZE 26214400 Net::SMTP=GLOB(0x1c9d748)<<< 250-ETRN Net::SMTP=GLOB(0x1c9d748)<<< 250-STARTTLS Net::SMTP=GLOB(0x1c9d748)<<< 250-ENHANCEDSTATUSCODES Net::SMTP=GLOB(0x1c9d748)<<< 250-8BITMIME Net::SMTP=GLOB(0x1c9d748)<<< 250 DSN Issuing STARTTLS... Net::SMTP=GLOB(0x1c9d748)>>> QUIT Net::SMTP=GLOB(0x1c9d748)<<< 221 2.0.0 Bye The transaction failed: Can't locate object method "starttls" via pack +age "Net::SMTP" at /srv/www1-ssl/cgi-lib/sendmail.pm line 74. Transmission failure

UPDATE: I had to update both Net::SMTP and IO::Socket::SSL from CPAN. After the update STARTTLS could be issued, but that caused another bunch of problems to appear:

Sanity check of recipient address... <recipient address shown here> Net::SMTP>>> Net::SMTP(3.10) Net::SMTP>>> Net::Cmd(3.10) Net::SMTP>>> Exporter(5.68) Net::SMTP>>> IO::Socket::IP(0.37) Net::SMTP>>> IO::Socket(1.36) Net::SMTP>>> IO::Handle(1.34) Net::SMTP=GLOB(0x20461c8)<<< 220 <domain shown here> mail. All spam is + reported. ESMTP Net::SMTP=GLOB(0x20461c8)>>> EHLO <domain shown here> Net::SMTP=GLOB(0x20461c8)<<< 250-<server address shown here> Net::SMTP=GLOB(0x20461c8)<<< 250-PIPELINING Net::SMTP=GLOB(0x20461c8)<<< 250-SIZE 26214400 Net::SMTP=GLOB(0x20461c8)<<< 250-ETRN Net::SMTP=GLOB(0x20461c8)<<< 250-STARTTLS Net::SMTP=GLOB(0x20461c8)<<< 250-ENHANCEDSTATUSCODES Net::SMTP=GLOB(0x20461c8)<<< 250-8BITMIME Net::SMTP=GLOB(0x20461c8)<<< 250 DSN Issuing STARTTLS... Net::SMTP=GLOB(0x20461c8)>>> STARTTLS Net::SMTP=GLOB(0x20461c8)<<< 220 2.0.0 Ready to start TLS Sending MAIL FROM... Net::SMTP=GLOB(0x20461c8)>>> MAIL FROM:<sender address shown here> Net::SMTP: Net::Cmd::getline(): unexpected EOF on command channel: at + /srv/www1-ssl/cgi-lib/sendmail.pm line 76. Attempting RCPT TO... Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: + at /srv/www1-ssl/cgi-lib/sendmail.pm line 78. Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: + at /srv/www1-ssl/cgi-lib/sendmail.pm line 78. Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: + at /srv/www1-ssl/cgi-lib/sendmail.pm line 102. Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: + at /srv/www1-ssl/cgi-lib/sendmail.pm line 102. The transaction failed: Connection refused Transmission failure

Replies are listed 'Best First'.
Re^3: Net::SMTP - Connection to local MTA refused
by kschwab (Vicar) on Mar 07, 2017 at 20:56 UTC
    It appears the MTA is closing the connection right after you send the "MAIL FROM:" string.
    Net::SMTP=GLOB(0x20461c8)>>> MAIL FROM:<sender address shown here>
    Net::SMTP: Net::Cmd::getline(): unexpected EOF on command channel:  at
    + /srv/www1-ssl/cgi-lib/sendmail.pm line 76.
    

    So, it's either the MTA itself, or some external thing like AppArmor (enabled by default in the OpenSuse version you mention).

    I would look at the logs for whatever your MTA is (exim maybe?) as well as AppArmor, SELinux, or whatever other external security stuff you may have running.

    Maybe also try "service boot.apparmor stop", and see if turning off AppArmor makes a difference. Not the right solution, but quick to try.

      My MTA is Postfix, and AppArmor is disabled (I'm currently running SELinux in Permissive mode so that doesn't interfere at the moment).

      Unfortunately the logs haven't turned up anything that could be of help so I'm at a loss here.

        Turn on verbose logging in Postfix, or try some of the other things on this page.

        Your logs show pretty clearly that it's postfix closing the connection (assuming apparmor and similar aren't doing it), so this should unearth something

Re^3: Net::SMTP - Connection to local MTA refused
by huck (Prior) on Mar 08, 2017 at 05:12 UTC

    ok, i may be missing something here, but dont modern mail senders require you to authenticate first? ie:

    $l_mailer->auth($smtpuser, $smtppassword);
    before
    $l_mailer->mail($p_sender);

      That would be necessary if the form mailer sent its data through the submission port (587/tcp). However, I'm sending this through port 25 which doesn't require authentication (it's normally used so that other MTAs can connect, but localhost is allowed to send there, too).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1183821]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-25 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found