Want to subscribe to topics you're interested in?
Become a Member

Email mail function hangs - no more emails from system

Discussion in 'Install & Upgrades or Pre-Install Questions' started by EckyBrazzz, Apr 26, 2019.

  1. EckyBrazzz

    EckyBrazzz Active Member

    917
    190
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +363
    Local Time:
    4:50 PM
    Latest
    Latest
    Hi,

    Had a big problem with a DO Droplet and had a snapshot of it. I was unable to shut or start the Droplet, it kept in a LOOP. Support of DO did after 3 days a forced stop, but in the meantime, I created a new Droplet from a snapshot that I made just before the event and did some great improvements on that one that I don't want to lose these.


    The only issue I have now is that the mail function stopped working. I don't know if this has to do with the old setting of CSF but when I call mail it just hangs there and does nothing.

    Also, the Securi Security firewall does not send any notifications, nor any event that happens on WordPress(*ADDED 25/04 RESOLVED WP ISSUE). Cronjobs with -s mymail@domain don't work anymore..
    Any advice/help is highly appreciated.
     
    Last edited: Apr 26, 2019
  2. EckyBrazzz

    EckyBrazzz Active Member

    917
    190
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +363
    Local Time:
    4:50 PM
    Latest
    Latest
    Nice of them to add S10 Credit, but noticed that the IP of the new Droplet is Blacklisted as SPAM. Will try a other IP to see if the problem remains.

     
  3. eva2000

    eva2000 Administrator Staff Member

    58,905
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    5:50 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    how are you calling mail function - specific example ?

    the obvious question is Postfix MTA mail server service running ?
    Code (Text):
    service postfix status

    are cronjobs running ?
    Code (Text):
    service crond status


    So problem is droplet IP spam blacklisted and you aren't receiving emails at all ? or emails landing in junk/spam box ? Make sure you had done all the necessary steps to ensure email isn't marked as spam.

    It all starts with Getting Started Guide step 1 which outlines critical steps in setting up properly your main hostname's DNS etc. You must setup a hostname.domain.com for main hostname and setup proper DNS A, SPF/TXT records (and DNS AAAA if you use IPv6 on server)
    Then follow steps outlined in Getting Started Guide step 8 which link to Email - Steps to ensure your site/server email doesn't end up in spam inboxes and make sure your main hostname and domain name have their respective PTR, SPF, DKIM and DMARC DNS records setup.

    To change where root user emails go like SSH alerts etc, see steps outlined in Getting Started Guide step 18 for setting up /root/.forward file. That only changes where emails are sent to not what email address it's sent from. Instead of changing from email, it's best to just filter the emails from your email client via 'email to' address keyword.

    If you use Gmail or Google Apps based email for the listing in your /root/.forward file, you can make it even easier to setup a filtered label by using email alias. If your Gmail address is yourusername@gmail.com, you can append +label to your username and still get emails but then you can filter based on the that specific delivered to address. For example, yourusername+linode1@gmail.com emails with an alias of +linode1, will still go to yourusername@gmail.com but the delivered to address you receive from will be listed as yourusername+linode1@gmail.com. So you can filter based on yourusername+linode1@gmail.com.
     
  4. EckyBrazzz

    EckyBrazzz Active Member

    917
    190
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +363
    Local Time:
    4:50 PM
    Latest
    Latest
    Well, First to know. I changed only the DNS for the new server4 to the correct IP, for the rest I kept the DNS intact, removed the old one of course.
    Code (Text):
    00 */8 * * * /usr/local/sbin/update-ngxblocker -c /usr/local/nginx/conf/ultimate-badbot-blocker -b /usr/local/nginx/conf/ultimate-badbot-blocker/bots.d -e pirvate@private.com

    Well, the above doesn`t work anymore.
    Postfix is active, already checked it. But you asked the result so posting it.
    Code (Text):
    [23:09][root@server4 etc]# service postfix status
    Redirecting to /bin/systemctl status postfix.service
    ● postfix.service - Postfix Mail Transport Agent
       Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
       Active: active (running) since Thu 2019-04-25 18:59:25 UTC; 4h 9min ago
      Process: 14176 ExecStop=/usr/sbin/postfix stop (code=exited, status=0/SUCCESS)
      Process: 14193 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
      Process: 14192 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
      Process: 14186 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
     Main PID: 14265 (master)
       CGroup: /system.slice/postfix.service
               ├─14265 /usr/libexec/postfix/master -w
               ├─14267 qmgr -l -t unix -u
               ├─14275 tlsmgr -l -t unix -u
               └─19789 pickup -l -t unix -u
    
    Apr 25 21:00:03 server4 postfix/cleanup[17848]: E98EF20147F4: message-id=<20190425210003.E98EF20147F4@server4>
    Apr 25 21:00:03 server4 postfix/qmgr[14267]: E98EF20147F4: from=<root@server4>, size=1308, nrcpt=1 (queue active)
    Apr 25 21:00:03 server4 postfix/local[17851]: E98EF20147F4: to=<root@server4>, orig_to=<root>, relay=local, delay=2.6, delays=2....o mailbox)
    Apr 25 21:00:03 server4 postfix/qmgr[14267]: E98EF20147F4: removed
    Apr 25 22:57:27 server4 postfix/pickup[19789]: 5C2E920147F4: uid=0 from=<root>
    Apr 25 22:57:27 server4 postfix/cleanup[20796]: 5C2E920147F4: message-id=<20190425225727.5C2E920147F4@server4>
    Apr 25 22:57:27 server4 postfix/qmgr[14267]: 5C2E920147F4: from=<root@server4>, size=494, nrcpt=1 (queue active)
    Apr 25 22:57:28 server4 postfix/smtp[20798]: Trusted TLS connection established to mx.zoho.com[204.141.42.121]:25: TLSv1.2 with cipher ECDHE-RSA-AES256-SH.../256 bits)
    Apr 25 22:57:29 server4 postfix/smtp[20798]: 5C2E920147F4: to=<private@private.com.br>, relay=mx.zoho.com[204.141.42.121]:25, delay=2.4, delays=0.02/0.01/1.4/... received)
    Apr 25 22:57:29 server4 postfix/qmgr[14267]: 5C2E920147F4: removed
    Hint: Some lines were ellipsized, use -l to show in full.
    

    And Cronjob
    Code (Text):
    [23:09][root@server4 etc]# service crond status
    Redirecting to /bin/systemctl status crond.service
    ● crond.service - Command Scheduler
       Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
       Active: active (running) since Wed 2019-04-24 20:11:56 UTC; 1 day 3h ago
     Main PID: 3946 (crond)
       CGroup: /system.slice/crond.service
               └─3946 /usr/sbin/crond -n
    
    Apr 24 20:11:56 server4 systemd[1]: Started Command Scheduler.
    Apr 24 20:11:56 server4 crond[3946]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 27% if used.)
    Apr 24 20:11:56 server4 crond[3946]: (CRON) INFO (running with inotify support)
    


    As told before that the system was in a startup loop, everything was oke, no problem at all.

    Even the snapshot that I made to rebuild the Droplet was 100% , everything was working when I made the snapshot. (With Droplet turned off as advices to keep data integrity).

    Only some things were missing in the new droplet, that added I again like the ~bashrc to get a mail when there is a login to the system.
     
  5. EckyBrazzz

    EckyBrazzz Active Member

    917
    190
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +363
    Local Time:
    4:50 PM
    Latest
    Latest
    Well just noticed that my email goes to SPAM folder :(
    Started a new Droplet to make sure that I have another IP
    Code (Text):
    echo "mail-test" | mail -s "mail-tester" private@private.com.br
     
  6. eva2000

    eva2000 Administrator Staff Member

    58,905
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    5:50 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    ensure you've followed all steps at https://community.centminmod.com/th...ver-email-doesnt-end-up-in-spam-inboxes.6999/ and try the troubleshooting tests and online checks as well