Having trouble sending out mails

Discussion in 'Installation/Configuration' started by Werner van Schie, Jul 30, 2019.

  1. Werner van Schie

    Werner van Schie New Member

    I'm on:
    Debian GNU/Linux 9.9 (stretch)
    ISPConfig 3.1.14p2

    I just configured my first mailbox... but can't send emails out.

    This is the line in /etc/mail.log that says it all:
    Code:
    postfix/smtp[5339]: 6AE6540516: to=<[email protected]>, relay=none, delay=0.14, delays=0.13/0/0/0, dsn=4.4.1, status=deferred (connect to 127.0.0.1[127.0.0.1]:10026: Connection refused)
    By now I googled so much I found out 10026 is an amavis port and it is supposed to be up and running. But it's not reported in netstat as open (neither is 10024) :

    Code:
     # netstat -tanp|grep 100
    tcp        0      0 127.0.0.1:10023         0.0.0.0:*               LISTEN      847/postgrey --pidf
    tcp        0      0 127.0.0.1:10025         0.0.0.0:*               LISTEN      6667/master
    tcp        0      0 127.0.0.1:10027         0.0.0.0:*               LISTEN      6667/master
    tcp6       0      0 :::3306                 :::*                    LISTEN      1004/mysqld
    
    And I get this "(exited)" is not looking too good, upon doing "/etc/init.d/amavis status" :
    Code:
    ● amavis.service - LSB: Starts amavisd-new mailfilter
       Loaded: loaded (/etc/init.d/amavis; generated; vendor preset: enabled)
       Active: active (exited) since Tue 2019-07-30 14:52:10 CEST; 26min ago
         Docs: man:systemd-sysv-generator(8)
      Process: 8382 ExecStop=/etc/init.d/amavis stop (code=exited, status=0/SUCCESS)
      Process: 8388 ExecStart=/etc/init.d/amavis start (code=exited, status=0/SUCCESS)
        Tasks: 0 (limit: 4915)
       CGroup: /system.slice/amavis.service
    
    Jul 30 14:52:10 <mydomain> systemd[1]: Stopped LSB: Starts amavisd-new mailfilter.
    Jul 30 14:52:10 <mydomain> systemd[1]: Starting LSB: Starts amavisd-new mailfilter...
    Jul 30 14:52:10 <mydomain>  systemd[1]: Started LSB: Starts amavisd-new mailfilter.
    
    Also I get no logs from amavis. Apparently "something" makes amavis exiting... so I thought, let's make it log. I changed the log level into 5 (in /etc/amavis/conf.d/50-user) . But it doesn't create a /var/log/amavis.log (as configured). Nor does it append its loglines onto mail.log (as some sources say on the net)...

    I must have made a mistake somewhere, somehow. How to fix this without messing up my install (I do have a couple of non-emailing sites running ok). Thanks ia for your help.
     
    Last edited: Jul 30, 2019
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    https://www.howtoforge.com/community/threads/please-read-before-posting.58408/
    So this ISPConfig installation has been running for weeks already but you just yesterday tried e-mail for the first time?
    Check you have installed and configured postfix, dovecot, roundcube and amavis according to the perfect server guide. I assume you used (but can not know for sure, so verify how the setup was installed): https://www.howtoforge.com/community/threads/please-read-before-posting.58408/
    Try logging in to webmail and sending an e-mail to that same mailbox you logged in to. This shows if the e-mail system works at all.
    Check all services are running:
    Code:
    systemctl --state=failed
    Have you setup that host as an e-mail server, with MX-record, SPF, matching reverse DNS, mailname etc.? What shows
    Code:
    hostname
    hostname -f
     
  3. Werner van Schie

    Werner van Schie New Member

    Hi Taleman,
    Thank you *very much* for taking time to help me. I fixed it.

    It is correct, my ISPConfig has almost been running for a year now (I'm very happy with it!). I am using it for some development prototyping/testing, and I am hosting a small number of sites (simple sites only). Only starting this week I'm in need of a mail facility. I may have/probably skipped the mail-sections in the "Perfect Server"-instruction because I never needed them. I had a running config, that *seemed* okay, but apparently wasn't. All "auxilliary" stuff like reverse DNS-records, SPF etc. are all set (fairly sure correctly).

    I hope this reply will be of use for those facing similar issues. There are dozens of people on forums on the net that reported problems with amavis in a ISPConfig setup, getting "Connection refused on port 10026" for postfix. This might contain some pointers for them.

    This is the error line that it's about:
    Code:
    postfix/smtp[8613]: ADB014080D: to=<info@<mydomain>>, relay=none, delay=0.14, delays=0.12/0.02/0/0, dsn=4.4.1, status=deferred (connect to 127.0.0.1[127.0.0.1]:10026: Connection refused)
    Whenever I started amavis by hand, it would not echo anything... so this would result in nothing:
    Code:
    /etc/init.d/amavis start
    I was under the impression that it was normal behaviour. This was a wrong assumption. It looks like it's a sign of a damaged/incomplete amavis install.
    So, your
    Code:
    systemctl --state=failed
    pointed me in a right direction... ;)
    I made sure it was NOT running and decided to (re-?) install it:
    Code:
    apt-get amavis
    That installed amavis and a LOT of missing dependencies...

    Upon restart of amavis (/etc/init.d/amavis start) I got an error in /var/log/syslog:
    Code:
     amavis[4086]: Starting amavisd: ERROR: MISSING REQUIRED ADDITIONAL MODULES:
     amavis[4086]: DBD::mysql
    This could be due to the perl dbd mysql module missing. I installed it:
    Code:
    apt install libdbd-mysql-perl
    That process would also overwrite /etc/pure-ftpd/db/mysql.conf for me, so I noted down the old but correct (account-/server-/connection-) information (with the 'D' option to display differences between old and new) and changed those back in the new mysql.conf file.

    Then...
    Code:
     /etc/init.d/amavis start
    ...gave me:
    Code:
    [ ok ] Starting amavis (via systemctl): amavis.service.
    And tried to send a msg to self on roundcube, but KEPT GETTING:
    Code:
    postfix/smtp[8613]: ADB014080D: to=<info@<mydomain>>, relay=none, delay=0.14, delays=0.12/0.02/0/0, dsn=4.4.1, status=deferred (connect to 127.0.0.1[127.0.0.1]:10026: Connection refused)
    in /var/log/mail.log.

    By this time, I removed all references to a port 10026 in these three files:
    /etc/postfix/main.cf
    /etc/postfix/master.cf
    /etc/amavis/conf.d/50-user

    but I still kept getting that error!

    So from here, I did this:
    Code:
    cd /etc
    grep -r  "10026"
    
    (to find out where the occurrences of 10026 are).

    And then it came up with:
    /etc/postfix/tag_as_originating.re

    I have not seen this file mentioned in other people's posts concerning amavis errors on port 10026 so this might be of use to others.

    After I changed the port number in that file also (into 10024) and restarted postfix... low and behold... mail started flowing! :)

    From here on, I will further config the system. Again, thanks!
     

Share This Page