Exim4 message frozen because of subdomain

Hi,

Just installed HestiaCP on an Ubuntu 24.04 server.
Server’s hostname is staging.domain.tld but my external mail domain is domain.tld.
If I try to send email from HestiaCP host, emails are being sent as [email protected]

How do I set domain.tld as outgoing address?

Hi @jobet

How do you try to send the mail?

echo "This is the body of the email" | mail -s "This is the subject line" [email protected]

I solved the issue adding this to /etc/exim4/exim4.conf.template:

qualify_domain = domain.tld
qualify_recipient = domain.tld

Now issuing sudo exim -bt testuser
I see:
[email protected]
router = dnslookup, transport = remote_smtp

Is this the right way to do this?

But that shouldn’t work with your example. Did you test it?

echo “This is the body of the email” | mail -s “This is the subject line” [email protected]

To fix that you could add this to the end of the exim4.conf.template, in begin rewrite section.

*@staging.domain.tld [email protected] Eh

Yes, it worked fine.

However, a new problem came out… my server is sending outbound email directly to the Internet without going through my provider’s mail servers, that means my messages don’t get signed by the domain DKIM keys….

So, in this case I would need to use the relay host option instead!

Since I haven’t created a Mail domain in HestiaCP, which is the way to setup an SMTP relay host?

Maybe using the command?
bash /usr/local/hestia/install/upgrade/manual/configure-server-smtp.sh