Get the most out of your Centmin Mod LEMP stack
Become a Member

Beta Branch add tools/emailnotify.sh in 123.09beta01

Discussion in 'Centmin Mod Github Commits' started by eva2000, Aug 17, 2019.

  1. eva2000

    eva2000 Administrator Staff Member

    41,727
    9,396
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,432
    Local Time:
    2:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    add tools/emailnotify.sh in 123.09beta01

    - add tools/emailnotify.sh which is setup via a symlink to /usr/local/bin/emailnotify command on initial install for fresh installs or on existing installs after updated centmin.sh run to allow centmin.sh to send centmin mod related email notifications to user via the email addresses populated and setup in tools/email.sh for both primary & secondary email addresses prompts made on initial centmin mod install's first centmin.sh run (which is triggered via /usr/local/src/centminmod/tools/email.sh)
    - tools/emailnotify.sh or /usr/local/bin/emailnotify command will also do checks for a valid main server hostname reverse DNS PTR record and if not found will also display an error message directing users to instructions at Email - Steps to ensure your site/server email doesn't end up in spam inboxes to properly ensure emails sent by server do not end up in user's spam/jumk mail boxes
    - you can change the email addresses used for notification by re-running /usr/local/src/centminmod/tools/email.sh and updating both primary & secondary email addresses

    Code (Text):
    Usage:
    
    emailnotify send emailbody emailsubject
    


    Continue reading...

    123.09beta01 branch
     
    • Like Like x 2
  2. eva2000

    eva2000 Administrator Staff Member

    41,727
    9,396
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,432
    Local Time:
    2:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    • example usage for emailnotify command to send an email via system postfix MTA with body of email containing = testnote and subject of email = subjectnote
    • in this example an invalid reverse PTR DNS record is detected and error message is displayed
    • a gzip compressed mail log of the email sent is also saved to /root/centminlogs/emailnotify-maillog-170819-032308.log.gz - compressed size is usually ~400-800 bytes in size so not much room taken up
    Code (Text):
    emailnotify send testnote subjectnote
    

    Code (Text):
    server IPv4 IP: 111.111.111.111
    host.test.com checked DNS IPv4 record: 111.222.333.444
    
    -----------------------------------------------------------------------------
    fail: PTR IPv4 DNS record setup
    -----------------------------------------------------------------------------
    host.test.com reverse PTR lookup IPv4 not found
    host.test.com requires a working PTR DNS record to ensure
    server outbound sent emails are properly delivered to your
    previously setup server notification email addresses otherwise
    server sent emails end up in destination receipient's spam/junk
    mail box. Full instructions to remedy this can be read at
    https://community.centminmod.com/threads/6999/
    
    Cloudflare users should DISABLE 'orange cloud' Proxy on
    server's main host.test.com DNS record as enabling
    Cloudflare on main host.test.com DNS record will negatively
    impact proper email delivery from your server as destination
    mail servers can not do a proper reverse DNS PTR lookup to
    verify and match your main hostname host.test.com and it's
    resolving server IP address which currently points to:
    111.222.333.444
    -----------------------------------------------------------------------------
    
    echo "testnote" | mail -s " subjectnote - host.test.com Sat Aug 17 03:23:09 UTC 2019" [email protected]
    saving postfix maillog entry /root/centminlogs/emailnotify-maillog-170819-032308.log.gz
    
    to read use zcat:
    
    zcat /root/centminlogs/emailnotify-maillog-170819-032308.log.gz
    email sent at Sat Aug 17 03:23:09 UTC 2019
    
     
    • Like Like x 1
  3. pamamolf

    pamamolf Premium Member Premium Member

    3,477
    335
    83
    May 31, 2014
    Ratings:
    +642
    Local Time:
    7:07 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    What is this pass: output?

    Centos 7

    Code:
    emailnotify send testnote subjectnote
    -----------------------------------------------------------------------------
    pass:
    The output under pass: is ok...
     
  4. eva2000

    eva2000 Administrator Staff Member

    41,727
    9,396
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,432
    Local Time:
    2:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    no other output ? it should report the main hostname's reverse PTR lookup IP address in the text line starting with pass:
     
  5. pamamolf

    pamamolf Premium Member Premium Member

    3,477
    335
    83
    May 31, 2014
    Ratings:
    +642
    Local Time:
    7:07 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Yes everything under that is ok....

    I just wondering what is this pass:

    Code:
    emailnotify send testnote subjectnote
    -----------------------------------------------------------------------------
    pass:
    server.domain.com reverse PTR lookup IPv4 address = 123.456.789.000
    echo "testnote" | mail -s " subjectnote - server.domain.com Sat Aug 17 13:59:42 UTC 2019" [email protected]
    saving postfix maillog entry /root/centminlogs/emailnotify-maillog-170819-135942.log.gz
    
    to read use zcat:
    
    zcat /root/centminlogs/emailnotify-maillog-170819-135942.log.gz
    
     
  6. eva2000

    eva2000 Administrator Staff Member

    41,727
    9,396
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,432
    Local Time:
    2:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    oh that's okay i did a new line break after pass: that's why :)
     
    • Informative Informative x 1
  7. eva2000

    eva2000 Administrator Staff Member

    41,727
    9,396
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,432
    Local Time:
    2:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    I updated 123.09beta01 so it now shows as
    Code (Text):
    pass: ok

    to clear up any confusion :)
     
  8. eva2000

    eva2000 Administrator Staff Member

    41,727
    9,396
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,432
    Local Time:
    2:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  9. eva2000

    eva2000 Administrator Staff Member

    41,727
    9,396
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,432
    Local Time:
    2:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    So anymore folks tried out emalnotify command yet ? This will be used in future to notify users of software version updates etc.
     
  10. EckyBrazzz

    EckyBrazzz Active Member

    699
    139
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +258
    Local Time:
    1:07 PM
    1.17.x Cluster
    10.3.x Cluster & Redis
  11. eva2000

    eva2000 Administrator Staff Member

    41,727
    9,396
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,432
    Local Time:
    2:07 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Ah was thinking of pushover.net support as it's just supplying their email would allow push notifications :)
     
    • Agree Agree x 1