Learn about Centmin Mod LEMP Stack today
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

    54,362
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    1:46 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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
     
  2. eva2000

    eva2000 Administrator Staff Member

    54,362
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    1:46 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    • 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@domain.com
    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
    
     
  3. pamamolf

    pamamolf Premium Member Premium Member

    4,077
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    5:46 PM
    Nginx-1.25.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

    54,362
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    1:46 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    4,077
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    5:46 PM
    Nginx-1.25.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@gmail.com
    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

    54,362
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    1:46 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    oh that's okay i did a new line break after pass: that's why :)
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,362
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    1:46 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    I updated 123.09beta01 so it now shows as
    Code (Text):
    pass: ok

    to clear up any confusion :)
     
  8. eva2000

    eva2000 Administrator Staff Member

    54,362
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    1:46 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  9. eva2000

    eva2000 Administrator Staff Member

    54,362
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    1:46 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    916
    189
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +362
    Local Time:
    12:46 PM
    Latest
    Latest
  11. eva2000

    eva2000 Administrator Staff Member

    54,362
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    1:46 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Ah was thinking of pushover.net support as it's just supplying their email would allow push notifications :)
     
  12. eva2000

    eva2000 Administrator Staff Member

    54,362
    12,198
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,763
    Local Time:
    1:46 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+