Net::SMTP complains "cannot determine port at script.pl line X" regardless of port entered

Some background - we’re migrating from old Windows 2008 R2 environments that have been running v5.12.4 without issues for years. On the new environment we’re running the latest ActiveState build v5.28.1. I was expecting some issues between the versions but I’m running into several, one of which I already have a discussion going for but this is a different issue related to Net::SMTP.

In short, the Net::SMTP->new() constructor always returns complaining “cannot determine port at script.pl line X” regardless of what port I enter, even if I enter no port assuming the default. Has anyone else run into this? It’s almost as if the new() constructor is simply broken.

1 Like

Feels like a similar problem potentially where there are multiple modules providing the same thing (older ones separate, and never ones are in the libnet package). I would try just libnet, remove the Net-SMTP module and try again. Or you can try the project here: https://platform.activestate.com/Build-All-The-Things/Custom-Perl-5.28.1-Windows as it only has libnet in it.

Let me know how it goes and if that doesn’t help maybe provide a quick code sample (sensitive info sanitized) and I can dig in further.

1 Like

Jeff - you are a genius! So confirmed the build with just libnet you gave me works as expected, the legacy Net-SMTP and Net-FTP are simply broken. I missed the memo / developments on libnet, that certainly makes things easier but when I do a search I don’t find a lot of info on it. I didn’t understand that by including libnet I get all those other modules included for free. This is definitely different then the build I was used to which is probably at least 8 years old (but everything just worked). Are there plans to either fix the legacy Net-SMTP / Net-FTP or will they be removed in favor of libnet?

Jeff, one more thing - while trying to get anything at all to work I also tried Email::Sender::Transport::SMTP and it looks like it also has the same issue as Net-SMTP. It too is broken.

We are looking into removing the legacy versions from our catalog so users in the future don’t run into this issue, but there may be other complications here so we have to be careful. i.e. you don’t want to break someone else’s build if they are relying on it etc. I will take a look at Email::Sender::Transport::SMTP and see what it going on there.

The Email-Sender version 1.300035 is the one you want for Email::Sender::Transport::SMTP. I’m not sure if there is a conflicting class in your build for this so guessing a bit here. Hope that helps.

Cheers,

-JR

1 Like