Welcome to Centmin Mod Community
Become a Member

DNS Email Server not sending mail

Discussion in 'Domains, DNS, Email & SSL Certificates' started by Itworx4me, Mar 21, 2017.

  1. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
    Hello,

    Can someone point me in the right direction on how to fix this? I am running google apps. My MX Record are correct. I can send and recieve just find using gmail. I use xenforo and I am trying to use the contact us link and the email doesn't get delivered. I thought a port might be blocked but it doesn't appear to be. I ran the following commands:
    Code:
    [02:28][root@hostname.domain.com ~]# netstat -an | grep 465 | grep -i listen
    You have new mail in /var/spool/mail/root
    [02:39][root@hostname.domain.com ~]# netstat -an | grep 587 | grep -i listen
    [02:40][root@hostname.domain.com ~]# netstat -an | grep 25 | grep -i listen
    tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
    tcp        0      0 ::1:25                      :::*                        LISTEN
    
    Any help would be appreciated.

    Thanks,
    Itworx4me
     
  2. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    Checked spam inbox ?

    Postfix is configured for sending out emails for all domains out of box. So you're all taken care of for any site hosted on your server for Postfix outgoing emails sent from the main host name so emails sent from @mainhost.domain.com. Which is why Getting Started Guide step 1 for proper main hostname DNS configuration is important for properly email delivery via Postfix and also mentioned at Email - Steps to ensure your site/server email doesn't end up in spam inboxes | Centmin Mod Community
     
  3. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
    This was the first item I checked. Noting there. I checked this file /usr/local/nginx/conf/conf.d/virtual.conf and it has been edited correctly. At a loss...lol
     
  4. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
  5. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
    How do I run opendkim.sh?
     
  6. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    see https://community.centminmod.com/threads/automated-dkim-setup-with-opendkim.7011/

    To run addons/opendkim.sh type the following which uses git to update the local Centmin Mod code to latest (same as running centmin.sh menu option 23 submenu option 2) and then running addons/opendkim.sh:
    Code (Text):
    cd /usr/local/src/centminmod
    git stash
    git pull
    cd addons
    ./opendkim.sh
    

    A log file is created by addons/opendkim.sh at /root/centminlogs/dkim_spf_dns_host.domain.com.txt. Contents has a copy of the DKIM TXT record as well as a generic SPF TXT record that you may also want to add a DNS TXT record at your DNS provider
     
  7. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
    Ok I have it sending emails now using this:
    Code:
    echo "dkim test today `date`" | mail -s "dkim test `date`" webmaster@domain.com
    but it goes straight to spam.

    SPF record:
    type:spf
    name: hostname.domain.com
    value: v=spf1 a mx ~all
    TTL Automatic

    I also setup a DKIM record too.
    type: txt
    name:default._domainkey.firegrilled.domain.com
    value:"v=DKIM1; k=rsa;" "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCweLeci2ciDwYo0I4nzWlSPU1YIQH+t3a9+5C+tfXEA6888yuTZRjJAxsiwqO1sexxS3OoijcejvrzmQ8LHHbpVz3WYbNGDptn4+MWV7NNPrDiaqqbU7H58qz06OZOirBN07qEH7hTPkjRFTrN4LdtnI+cq8+mmy8dpaUvj3DSIwIDAQAB"
    TTL: Automatic

    It still won't send using the xenforo contact us form.

    Where do I go from here?

    Thanks,
    Itworx4me
     
    Last edited: Mar 21, 2017
  8. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    Where is destination email hosted ? Gmail or Gsuite apps ? view email and view select 'Show Original' for email should give you something like

    upload_2017-3-21_15-56-28.png

    status of your SPF, DKIM and DMARC records - depending on DNS provider can take while to update DNS

    various tools outlined at https://community.centminmod.com/th...ver-email-doesnt-end-up-in-spam-inboxes.6999/ to test validity of your SPF, DKIM and DMARC records and also test if your server IP address is blacklisted or domains listed in email are blacklisted.
     
  9. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
    When I open this file its empty
    /etc/opendkim/keys/host.domain.com/default.txt
     
  10. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
    Code:
    Original Message
    
    Message ID    <201703210537.v2L5bP8F023540@firegrilled.food-karts.com>
    Created at:    Mon, Mar 20, 2017 at 10:37 PM (Delivered after 1 seconds)
    From:    root <root@firegrilled.domain.com>
    To:    webmaster@domain.com
    Subject:    dkim test Tue Mar 21 05:37:25 UTC 2017
    SPF:    NEUTRAL with IP 2602:ffc5:60:0:0:0:1:ef93 Learn more
    DKIM:    PASS with domain firegrilled.domain.com Learn more
     
  11. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    looks like didn't create it properly, try running clean command which will delete previous entry try and re-generate a new set of SPF and DKIM records
    Code (Text):
    cd /usr/local/src/centminmod
    git stash
    git pull
    cd addons
    ./opendkim.sh clean

    You'll need to update SPF and DKIM TXT DNS records again with newly generated ones logged at /root/centminlogs/dkim_spf_dns_hostname.domain.com_210317-060106.txt which is date/timestamped for hostname.domain.com i.e. firegrilled.domain.com

    then check your /etc/opendkim/keys/host.domain.com/default.txt i.e. /etc/opendkim/keys/firegrilled.domain.com/default.txt should contain the RSA Private key for DKIM
     
  12. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    make sure you have a reverse PTR record for your IPv6 address too and not just IPv4 ip address PTR
     
  13. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
  14. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    seen to select DKIM from select dropdown menu first then input default._domainkey.firegrilled.domain.com
     
  15. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
    Ok I have got resoving spf records now. I also have a DKIM that resolves. Working on the PTR. Not sure how to set that one up yet...lol
    I tried this code again: echo "dkim test today `date`" | mail -s "dkim test `date`" webmaster@domain.com

    and now I get nothing. Not even in my spam folder...I am using google apps.

    Thanks for all your help George

    Itworx4me
     
  16. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    PTR might need your web host intervention if your web hosts control panel doesn't have an option to setup PTR i.e. some solusvm VPS panels allow you add reverse PTR record yourself, others require your web host to do it for you
     
  17. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
    @eva2000 can you give me an example of what a PTR record would look like? My host hasn't got back to me on this issue. Might have to go it alone and figure it out.
    Thanks,
    Itworx4me
     
  18. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    You can't do it yourself, it has to be done by your web host at their end for PTR if they don't offer an option in their server dashboard i.e. Vpses some use solusvm and allow you to set it up there
     
  19. Itworx4me

    Itworx4me Member

    31
    1
    8
    Mar 14, 2017
    Ratings:
    +1
    Local Time:
    3:43 AM
    @eva2000 yes they do allow me to submit a record. I just don't know what to put there. I will show you what they have:

    test.png
    I just don't know what to put in the submit box?
     
  20. eva2000

    eva2000 Administrator Staff Member

    29,057
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    8:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    for main ip, you put your main hostname which would be same as hostname on order form and same as one setup in step 1 of getting started guide

    same one that is displayed from output of the command
    Code (Text):
    hostname