1753779 Members
7851 Online
108799 Solutions
New Discussion юеВ

mailx port

 
Martin Johnson
Honored Contributor

mailx port

I have a script that checks to see if an application is running. If the application is not running it uses mailx to send a message that the application is down. Unfortunately, the messages are not being received. I'm sure it is a firewall issue. My problem is I don't know which port mailx uses, so I don't know which port to open.

Ten points for the right answer!

Marty
12 REPLIES 12
Steven Schweda
Honored Contributor

Re: mailx port

SMTP normally uses port 25.

> [...] I'm sure [...]

Because ...?

You can run a simple test using Telnet to see
if there's some obvious problem. Something
like:

telnet server_system 25

(A suitable Web search should reveal how to
send an actual e-mail message that way, too.)
Martin Johnson
Honored Contributor

Re: mailx port

Unfortunately, telnet has been disabled in this environment.

Marty
Steven Schweda
Honored Contributor

Re: mailx port

> Unfortunately, telnet has been disabled in
> this environment.

What, exactly, does that mean? Disabling the
Telnet service on some system does not
normally affect anyone's ability to run a
Telnet client program, especially when one
is not using the normal Telnet port (and/or
one is doing it on some other system).

> telnet server_system 25

Did you actually _try_ this, or is this
another case of "I'm sure" without any actual
evidence?
Matti_Kurkela
Honored Contributor

Re: mailx port

A traditional mailx binary does not use network at all. Instead, it does some pre-processing and then invokes "/usr/sbin/sendmail" (= the local MTA, which actually may be Exim, Postfix, Qmail or something else) in one-shot mode to actually send the message.

You should view the mail logs of your system to see what happens to the message you tried to send with mailx. Usually this log is at /var/log/mail.log.

If it's a firewall issue, then the messages might still be in the local outgoing mail queue: use the "mailq" command to view the mail queue status.

When the local MTA attempts to deliver outgoing mail, it normally uses the SMTP protocol, which uses TCP port 25 as standard. If SMTP-over-SSL is configured for some particular mail destination, TCP port 465 might also be used, but this is somewhat uncommon.

MK
MK
Martin Johnson
Honored Contributor

Re: mailx port

Steven,

When I try to telnet I get this:

telnet localhost 25
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host: Connection refused

Marty
Martin Johnson
Honored Contributor

Re: mailx port

Matti,

/var/log/maillog has the following entry after I execute a mailx command:

Apr 23 15:15:17 lnxopsd1as01 sendmail[8010]: o3NFFHwd008010: to=Marty.Johnson@staples.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30045, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

Marty
Patrick Wallek
Honored Contributor

Re: mailx port

>>stat=Deferred: Connection refused by [127.0.0.1]

That is the key. The connection is refused. That was also the case with your 'telnet localhost 25'.

There are 2 possiblities:

1) There is nothing listening on port 25

2) Port 25 may be blocked by your firewall.
Martin Johnson
Honored Contributor

Re: mailx port

Patrick,

I suspect it is a firewall issue.
lsof -i:25 shows nothing is listening on port 25. It also shows nothing is listening on a node where I can send a successful mail message.

Marty
Martin Johnson
Honored Contributor

Re: mailx port

Actually, the problem turned out to be sendmail was not running. I started sendmail and received a bunch of messages. I guess the messages queue up when sendmail is not running.

Marty