Root email alias not working


NethServer Version: NS7
Module: email

I’m using the web console diagnostics page to send a test email, but it’s not working.

“root” is automatically entered in the “mailbox to test” box.
I have an alias configured for “root@” to point to is configured on the email tab.

here is the entry from /etc/postfix/virtual
#generic aliases expansion (address@)

however the mail never arrives in the mail box.

If i send a message from the command line using
echo "subject: test" | sendmail -v
that does arrive in the mailbox.

I’ve tried changing the /etc/postfix/virtual entry to
then issuing postmap /etc/postfix/virtual and then postfix reload, but email from the diagnostic page isn’t delivered to

why can’t i test email delivery from the diagnostic page of the web interface?


Hi Bob,

you may setup an address for root that works in diagnostic panel in the profile options, seems like an alias for root is not used locally.

NethServer uses a template system to write config files. Config files are rewritten on updates/reboot. You may customize your config with custom templates:

hello @mrmarkuz
Thank you for the reply. I’ve added a real email address to the root user profile, just as you suggested. Now I get delivery reports for every message routed through my mail server. The server is using getmail and routing email via sendmail, so I get a delivery report for every message.

thank you for the information about the template system, please note I manually changed the config files but did not do anything via the web interface to trigger a refresh of the config files. So I assume my manual changes to the postmap wern’t overwritten.

why does setting an alias for root through the web config not work?


Yes, but they will be overwritten. You may restore the original config file with expand-template /etc/postfix/virtual

What do you want to do exactly? What’s the goal?
You may set root as destination for a mail alias so mails to an email address like alias@domain.tld go to root.

An alias usually is a mail address. root is a system user and a special case.
Maybe the name of the config file creates some confusion. In the root profile page you change /etc/aliases. In the mail aliases page you change /etc/postfix/virtual.

1 Like

Morning mrmarkuz,

What do I want to do exactly?

I’m trying to ensure that if the system sends an email to root, that message goes to a system user.

e.g. if an error occurs and an error report is sent to root I want that message sent to a system user. That’s why I’ve configured an alias that should send email addressed to root@ to, but it doesn’t.

Does the system send error reports via email to root?


OK, for root that’s possible via the profile page. I did some research and to get mail from root /etc/aliases is used:


1 Like

Hello mrmarkuz,
Thanks again for your reply.
I’ve noticed that some of the system cron jobs dont send their output to the null device, so they send their output to root - which is why i’m getting lots of system messages.

e.g. some cron jobs have &>/dev/null after them, to make them send their output to null. Other cron jobs don’t have this and therefore generate system messages.

thanks for your help.


1 Like

I think this is because root@ is expanded like root@$(hostname -d) (only domain part), whilst a local user name (i.e. root) is expanded to root@$(hostname) (the host FQDN). This leads to very different mail recipients!

In other words, by defining a root@ alias you are not obtaining what you expect. Instead, like @mrmarkuz said, go to the root’s Profile page and set the email forward address.

I think we’re lacking a documentation page for this :thinking:

1 Like