in reply to How Do I find the Port Number For an Internet Service?

print `nmap -sS -v -v $hostname` is one way for detecting the port number on a remote system.

For detecting what is going on in your own system you might want to try print `netstat -ap` and look for what ports sendmail has bound to.

Assuming you really want to port scan yourself you could try Net::Telnet and try connecting to every port you can and see if you get the introductory SMTP message. Or implement it yourself using IO::Socket::INET.

Personally I would just try port 25 as a first guess, however.