/bin/mail config

Issues related to applications and software problems
Post Reply
username
Posts: 76
Joined: 2013/03/04 13:17:23

/bin/mail config

Post by username » 2017/09/26 08:10:06

Hi,

I'm trying to send an email from my server using a simple command (Postfix is not installed) :
/bin/mail -s "Test Subject" admin@myemail.net < /dev/null

But I get an error :
send-mail: Cannot open mail:25

When I check /var/log/maillog :

Code: Select all

Sep 19 12:15:33 myserver sSMTP[1624]: Cannot open mail:25
Sep 19 12:15:35 myserver sSMTP[1626]: Unable to connect to "mail" port 25.
Sep 19 12:15:35 myserver sSMTP[1626]: Cannot open mail:25
Sep 19 12:16:00 myserver sSMTP[1842]: Unable to connect to "mail" port 25.
Sep 19 12:16:00 myserver sSMTP[1842]: Cannot open mail:25
Sep 19 12:27:35 myserver sSMTP[1914]: Connection lost in middle of processing
Sep 19 12:30:37 myserver sSMTP[1961]: Connection lost in middle of processing
Sep 19 12:30:50 myserver sSMTP[2109]: Unable to connect to "mail" port 25.
Sep 19 12:30:50 myserver sSMTP[2109]: Cannot open mail:25
My firewall :

Code: Select all

public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: dhcpv6-client http ssh https smtp
  ports: 32469/tcp 22000/tcp 32410/udp 3005/tcp 1900/udp 8080/tcp 8000/tcp 5353/udp 12001/tcp 8096/tcp 25/tcp 32400/tcp 51413/tcp 8324/tcp 32414/udp 32413/udp 9091/tcp 10001/tcp 8920/tcp 32412/udp 8082/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
  
When I turn off Firewalld and try to send my mail again I get :
Connection lost in middle of processing

I've checked my /etc/hosts too and it looks good. I'm a bit lost there.

anderson_thomas
Posts: 96
Joined: 2011/11/21 10:19:41

Re: /bin/mail config

Post by anderson_thomas » 2017/09/26 08:32:57

Hi,

can you show the 'netstat -tulpen' command output?

Klaus.

username
Posts: 76
Joined: 2013/03/04 13:17:23

Re: /bin/mail config

Post by username » 2017/10/10 08:13:51

anderson_thomas wrote:Hi,

can you show the 'netstat -tulpen' command output?

Klaus.
Sorry for the late answer !

Code: Select all

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name    
tcp        0      0 0.0.0.0:32400           0.0.0.0:*               LISTEN      995        8552934    11763/Plex Media Se 
tcp        0      0 0.0.0.0:22000           0.0.0.0:*               LISTEN      0          14997      868/sshd            
tcp        0      0 127.0.0.1:32401         0.0.0.0:*               LISTEN      995        8552935    11763/Plex Media Se 
tcp        0      0 0.0.0.0:32469           0.0.0.0:*               LISTEN      995        8554651    11824/Plex DLNA Ser 
tcp        0      0 0.0.0.0:51413           0.0.0.0:*               LISTEN      1002       15024      869/transmission-da 
tcp        0      0 127.0.0.1:37782         0.0.0.0:*               LISTEN      995        8553848    11775/Plex Plug-in  
tcp        0      0 0.0.0.0:1048            0.0.0.0:*               LISTEN      995        8554644    11824/Plex DLNA Ser 
tcp        0      0 127.0.0.1:32600         0.0.0.0:*               LISTEN      995        8552964    11825/Plex Tuner Se 
tcp        0      0 0.0.0.0:9091            0.0.0.0:*               LISTEN      1002       15023      869/transmission-da 
tcp6       0      0 :::80                   :::*                    LISTEN      0          15095      873/httpd           
tcp6       0      0 :::8080                 :::*                    LISTEN      0          16445      901/(squid-1)       
tcp6       0      0 :::22000                :::*                    LISTEN      0          14999      868/sshd            
tcp6       0      0 :::51413                :::*                    LISTEN      1002       15026      869/transmission-da 
tcp6       0      0 :::8920                 :::*                    LISTEN      994        13627045   11611/mono-sgen     
tcp6       0      0 :::443                  :::*                    LISTEN      0          15105      873/httpd           
tcp6       0      0 :::8096                 :::*                    LISTEN      994        13627044   11611/mono-sgen     
udp        0      0 0.0.0.0:2626            0.0.0.0:*                           995        8554648    11824/Plex DLNA Ser 
udp        0      0 0.0.0.0:39683           0.0.0.0:*                           23         15049      901/(squid-1)       
udp    12800      0 0.0.0.0:39800           0.0.0.0:*                           995        8554617    11824/Plex DLNA Ser 
udp        0      0 0.0.0.0:7359            0.0.0.0:*                           994        13626295   11611/mono-sgen     
udp        0      0 127.0.0.1:56600         0.0.0.0:*                           994        13626293   11611/mono-sgen     
udp        0      0 0.0.0.0:36143           0.0.0.0:*                           995        8554657    11824/Plex DLNA Ser 
udp        0      0 ***.**.***.**:40432     0.0.0.0:*                           995        8554627    11763/Plex Media Se 
udp        0      0 127.0.0.1:44670         0.0.0.0:*                           995        8554624    11763/Plex Media Se 
udp        0      0 0.0.0.0:32410           0.0.0.0:*                           995        8554619    11763/Plex Media Se 
udp        0      0 0.0.0.0:32412           0.0.0.0:*                           995        8554620    11763/Plex Media Se                                           
udp        0      0 0.0.0.0:32413           0.0.0.0:*                           995        8554621    11763/Plex Media Se                                           
udp        0      0 0.0.0.0:32414           0.0.0.0:*                           995        8554618    11763/Plex Media Se                                           
udp        0      0 0.0.0.0:32826           0.0.0.0:*                           1002       15832      869/transmission-da                                           
udp        0      0 127.0.0.1:57433         0.0.0.0:*                           995        8554622    11763/Plex Media Se                                           
udp        0      0 ***.**.***.**:32887     0.0.0.0:*                           994        13626294   11611/mono-sgen     
udp        0      0 127.0.0.1:323           0.0.0.0:*                           0          15520      555/chronyd         
udp    12800      0 0.0.0.0:33510           0.0.0.0:*                           995        8552958    11824/Plex DLNA Ser 
udp        0      0 ***.**.***.**:37611     0.0.0.0:*                           995        8554623    11763/Plex Media Se 
udp        0      0 0.0.0.0:50324           0.0.0.0:*                           994        13627776   11611/mono-sgen     
udp        0      0 0.0.0.0:46731           0.0.0.0:*                           995        8554654    11824/Plex DLNA Ser 
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           994        13628659   11611/mono-sgen     
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           995        8554641    11824/Plex DLNA Ser 
udp        0      0 0.0.0.0:1901            0.0.0.0:*                           995        8554626    11763/Plex Media Se 
udp        0      0 ***.**.***.**:38806     0.0.0.0:*                           995        8554625    11763/Plex Media Se 
udp        0      0 0.0.0.0:51413           0.0.0.0:*                           1002       15027      869/transmission-da 
udp        0      0 0.0.0.0:51505           0.0.0.0:*                           1002       15833      869/transmission-da 
udp6       0      0 ::1:323                 :::*                                0          15521      555/chronyd         
udp6       0      0 :::54762                :::*                                23         15048      901/(squid-1)       
udp6       0      0 2001:****:*:****:51413 :::*                                1002       15029      869/transmission-da

anderson_thomas
Posts: 96
Joined: 2011/11/21 10:19:41

Re: /bin/mail config

Post by anderson_thomas » 2017/10/27 10:00:52

Hi,

there is nothing listen on port 25?

Klaus.

p.s. (Sorry for the late answer too!)

username
Posts: 76
Joined: 2013/03/04 13:17:23

Re: /bin/mail config

Post by username » 2017/11/15 13:36:59

Hi,

You are right. But I don't understand why...

This server is running CentOS 7 but when I compare it to another server running CentOS 6 :

Code: Select all

$ sudo netstat -tulpen
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      0          15695      7638/master 
I couldn't find out how to solve this so I ended up installing sendmail on CentOS 7. Now it works... It's weird though

On the CentOS 6 server, I'm not using sendmail or postix. Just /bin/mail and that's enough to send log reports by mail.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: /bin/mail config

Post by TrevorH » 2017/11/15 13:49:22

Your netstat output on CentOS 6 shows you have postfix running.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

username
Posts: 76
Joined: 2013/03/04 13:17:23

Re: /bin/mail config

Post by username » 2017/11/15 13:59:18

Ah ok, I was looking for ps -e | grep postfix

I found nothing so I thought it wasn't running. I didn't know it was running as "master"

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: /bin/mail config

Post by TrevorH » 2017/11/15 14:05:44

service postfix status
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

username
Posts: 76
Joined: 2013/03/04 13:17:23

Re: /bin/mail config

Post by username » 2017/11/15 14:24:16

Ha ! Thanks, I will remember next time.

Post Reply