# Emails not DKIM signed when email address domain differs from the mail server's domain

**URL:** <https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315>\
**Category:** Uncategorized\
**Created:** [April 8, 2023, 11:36am UTC](https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315 "2023-04-08T11:36:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![JvwComputing](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/j/5fc32e/32.png) [@JvwComputing](https://forum.hestiacp.com/u/JvwComputing)\
**Post date:** [April 8, 2023, 11:36am UTC](https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315/1 "2023-04-08T11:36:29Z")

</div>

My setup:

Server 1 (CPanel):  
Domain: domain.tld  
MX: mail.domain.tld  
Email: user@domain.tld

Server 2 (HestiaCP 1.7.2):  
Domain: sub.domain.tld  
MX: mail.sub.domain.tld

I have added server 2’s SPF and DKIM records to server 1’s DNS zone, however if I want to use Server 2’s mail server (mail.sub.domain.tld) to send emails using the user@domain.tld email address the header does not have a DKIM signature.

I’m not sure if this is configured intentionally on Hestia CP, but before when Server 2 used CPanel it worked and I could send DKIM signed emails using the user@domain.tld email address from the mail.sub.domain.tld mail server.

Can I make any changes to exim to DKIM sign emails sent from user@domain.tld using the mail.sub.domain.tld mail server?

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [April 8, 2023, 3:47pm UTC](https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315/2 "2023-04-08T15:47:07Z")

</div>

Use SMTP relay otherwise it is not possible

---

<div class="post-metadata">

**Author:** ![JvwComputing](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/j/5fc32e/32.png) [@JvwComputing](https://forum.hestiacp.com/u/JvwComputing)\
**Post date:** [April 11, 2023, 6:09am UTC](https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315/3 "2023-04-11T06:09:15Z")

</div>

Thanks for the reply.

Yes, for a test I hardcoded the exim config file to use the mail.sub.domain.tld dkim.pem file to sign the user@domain.tld email and it failed the dkim test which is worse than not having a dkim signature.

I restored the exim config to the default one and added the Amazon SES SMTP credentials to the SMTP Relay field for the sub.domain.tld domain, but emails are still sent using the local mail server and not via Amazon SES. I tested the Amazon SES SMTP and it works, but am I doing somthing wrong with the SMTP Relay setup?

---

<div class="post-metadata">

**Author:** ![Deepak](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@Deepak](https://forum.hestiacp.com/u/Deepak)\
**Post date:** [December 3, 2023, 6:08pm UTC](https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315/4 "2023-12-03T18:08:44Z")

</div>

As I no longer visit this forum frequently, I answer to your post as it appears some confusion.

You can sign any domain and any subdomain and have any ip address between the two.

You simply need to have correct TXT entries in the DNS. That is one of the most simple thing and all DKIM test will pass.

But this is difficult to understand, for less experienced admins, if doing this for the first time.

I have never used SMTP relay since years and am using since decades a subdomain setup for multiple email servers on subdomains.

The only nonsense is the extra-ordinary hard coding of “mail” that is based on [mail.domain.com](http://mail.domain.com) for everything that makes remaining complicated as it does not offer a choice like when you create a domain.

Was that your problem?

---

<div class="post-metadata">

**Author:** ![JvwComputing](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/j/5fc32e/32.png) [@JvwComputing](https://forum.hestiacp.com/u/JvwComputing)\
**Post date:** [December 4, 2023, 6:27am UTC](https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315/5 "2023-12-04T06:27:25Z")

</div>

I never managed to get SMTP relay or signing of the emails to work.

---

<div class="post-metadata">

**Author:** ![Deepak](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@Deepak](https://forum.hestiacp.com/u/Deepak)\
**Post date:** [December 4, 2023, 6:59am UTC](https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315/7 "2023-12-04T06:59:38Z")

</div>

Signing emails on an email subdomain server is one of the easiest thing.

You simply add a TXT record in DNS (in relating to an email subdomain server) with all entries by adding the subdomain part at the end of every TXT-key you may have added in the same manner for every main domain.

For example you have for main domain:

mail.\_domainkey

Then you have for subdomain called “[subdomain.domain.com](http://subdomain.domain.com)” like this:

mail.\_domainkey.subdomain

In the DNS, you simply copy the key (mail.\_domainkey) generated by Hestia in the DNS record of the mail domain in any external DNS provider, if you are using one. If you use Hestia DNS, you simply have to rename to above. Only after renaming - as suggested above for a subdomain -, the Nameserver (local or remote) will begin to answer DNS queries.

The same you need to do for DMARC and SPF. After doing this three elements of TXT in DNS, you will not have any problems with signing.

Its very simple.

By creating hard-coded subdomain structure by “mail”, youngsters in this coding group of Hestia have pumped multiple problems in many areas. This is one of them.

---

<div class="post-metadata">

**Author:** ![JvwComputing](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/j/5fc32e/32.png) [@JvwComputing](https://forum.hestiacp.com/u/JvwComputing)\
**Post date:** [December 4, 2023, 1:56pm UTC](https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315/8 "2023-12-04T13:56:49Z")

</div>

Thanks for emphasising three times how it’s the easiest thing in the world, I get it. BUT IT DOES NOT WORK IN HESTIA.

---

<div class="post-metadata">

**Author:** ![Deepak](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@Deepak](https://forum.hestiacp.com/u/Deepak)\
**Post date:** [December 4, 2023, 2:28pm UTC](https://forum.hestiacp.com/t/emails-not-dkim-signed-when-email-address-domain-differs-from-the-mail-servers-domain/9315/9 "2023-12-04T14:28:00Z")

</div>

Ok, then I must add that I am using DNS from Cloudflare. Before many years, or in earlier days, I applied these changes based on an explaination in Stack overflow.

And adding to this, I never dared or cared to test DNS based on hestia/named.

Named will simply capture the config files locally and if it contains a subdomain addition after the selector.\_domainkey in the TXT entry, it will process accordingly. Hestia has not much to do with it.

If you say you tried my solution and it did not work, then you may be right.
