Welcome to Centmin Mod Community
Become a Member

Email How to change Server outgoing mail From ROOT@Server.Hostname to just SERVER@HOSTNAME.COM ??

Discussion in 'Domains, DNS, Email & SSL Certificates' started by johnnyc, Dec 30, 2021.

  1. johnnyc

    johnnyc Member

    40
    2
    8
    Mar 23, 2015
    Ratings:
    +2
    Local Time:
    4:35 AM
    Centos 7.9 with beta09 running.

    I have a mail-tester.com score of 8/10.


    I cannot get 10/10 because the outgoing mail from my server originates from ROOT@SERVER.HOSTNAME.COM and i would rather it originated from SERVER@HOSTNAME.COM

    Does anyone have a clue how to do this?

    I'm using SENDMAIL, I have setup Domain Masquerade but it does not appear to be working. I also attempted to setup Generics-table and generics-domains (as found here: https://www.linuxquestions.org/ques...ddress-of-outgoing-emails-in-sendmail-571828/ ) but still no luck. I'm scratching my bald head.
     
  2. eva2000

    eva2000 Administrator Staff Member

    47,843
    10,916
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,956
    Local Time:
    8:35 PM
    Nginx 1.21.x
    MariaDB 10.x
    You're not meant to change the main hostname email domain but rather following steps outlined at https://community.centminmod.com/th...ver-email-doesnt-end-up-in-spam-inboxes.6999/ to ensure main hostname domain is delivered properly with correct SPF/DKIM records

    From https://community.centminmod.com/th...ver-email-doesnt-end-up-in-spam-inboxes.6999/ summary is
     
  3. johnnyc

    johnnyc Member

    40
    2
    8
    Mar 23, 2015
    Ratings:
    +2
    Local Time:
    4:35 AM
  4. eva2000

    eva2000 Administrator Staff Member

    47,843
    10,916
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,956
    Local Time:
    8:35 PM
    Nginx 1.21.x
    MariaDB 10.x
    which emails? If you're using php/web apps, you should configure sending email to use a 3rd party SMTP provider like Amazon SES https://community.centminmod.com/threads/amazon-aws-ses-smtp-transactional-email-info.13842/ @yourdomain.com on that side so from email is @yourdomain.com

    Centmin Mod LEMP stack doesn't support sending side emails for @yourdomain.com so you need to use a 3rd party provider like Amazon SES or others like https://community.centminmod.com/threads/free-yourdomain-com-email-accounts-alternatives.280/

    The main hostname @hostname.yourdomain.com is purely reserved for emails sent from your server for system related emails that you would receive i.e. if you set disk usage alerts https://community.centminmod.com/th...lert-daily-cronjob-email-notifications.14066/ or SSH login alerts https://community.centminmod.com/threads/ssh-login-email-alerts-centmin-mod-style.9498/ or Wordpress auto update cronjob alerts.
     
  5. johnnyc

    johnnyc Member

    40
    2
    8
    Mar 23, 2015
    Ratings:
    +2
    Local Time:
    4:35 AM
    Okay thank you eva,

    I've read your guide on email deliverability, I must be missing something, how do i make sure that the root@server.hostname.com is DKIM signed? Because I'm running mail-tester.com and it's saying that emails from root@server.hostname.com are not signed. I have keytable on signing table on and i have wildcarded entry for my domain *@domain.com for keytable, however that does NOT wildcard SUBdomains like root@SERVER.hostname.com

    Do I generate a new OPENDKIM for server.hostname.com specifically and add that to keytable? I don't think i can then add the signature to the NSD .zone file for the main /etc/nsd/master/domain.com.zone I already have a wildcarded entry in there for opendkim....am I supposed to generate a separate /etc/nsd/master/server.hostname.com.zone file for the hostname? Because simply added a line server 14400 etc to the hostname.com.zone, as well as a * entry in my hostname.com.zone file
     
  6. eva2000

    eva2000 Administrator Staff Member

    47,843
    10,916
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,956
    Local Time:
    8:35 PM
    Nginx 1.21.x
    MariaDB 10.x
    The guide at https://community.centminmod.com/th...ver-email-doesnt-end-up-in-spam-inboxes.6999/ links to this thread for setting up your main hostname's DKIM records via OpenDKIM at https://community.centminmod.com/threads/automated-dkim-setup-with-opendkim.7011/

    If you accidentally ran this for domains other than your main hostname, run the clean option first
    Code (Text):
    /usr/local/src/centminmod/addons/opendkim.sh clean
    

    Then re-run for your main hostname i.e. below my main hostname is = centos7.localdomain
    Code (Text):
    addons/opendkim.sh
    ---------------------------------------------------------------------------
    centos7.localdomain DKIM DNS Entry
    default._domainkey.centos7.localdomain  IN      TXT     "v=DKIM1; k=rsa; "        "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCsA2vO13aEozDDiFL8JHOi5lPVbx/gM0Vc/uFMnUbfK3EAdolx3newoXwNJTXojME1epmejvSuxq82Zh120FkZ7maqXI/NeFy3kyoeESWXjW+pEvY6ve2IBiTg/dCb+SEw5rM5YXd9jk1UJOpyvUXdnTDmcQuhLOGrmEu0hRe0TQIDAQAB"
    ------------------------------------------------------------
    centos7.localdomain SPF DNS Entry
    centos7.localdomain. 14400 IN TXT "v=spf1 a mx ~all"
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    DKIM & SPF TXT details saved at /root/centminlogs/dkim_spf_dns_centos7.localdomain_120416-141219.txt
    ---------------------------------------------------------------------------
    

    You then take the listed SPF and DKIM entries and add them to where your DNS is managed i.e. your web host or if you use Cloudflare, add them there in their DNS management areas. If you web host has delays for DNS updates, you'd need to wait for them to propagate.