Solved Change the Default Email Account for a Domain

Cordarex

Verified User
Joined
Sep 11, 2025
Messages
13
Hi everyone,
I could use some help with this.

Is it possible for a domain administrator or user to change the email account that is automatically created as the default address? For example, I’d like to change it from [email protected] to [email protected].

Ideally, I’d like to avoid maintaining the user’s mailbox if an alternative address can be designated as the default instead. From a DirectAdmin administrator’s perspective, it doesn’t matter which address is set as the default, as long as exactly one address is designated as such.

Am I overlooking this option in the admin backend, or is changing the default address something that can only be done by the user?

Thanks in advance for your help!
 
Last edited:
I'm just looking at this and the account e-mail address seems not necessarily also be the default address for the domain.
As admin, reseller or user, you should be able to login into the domain.
Then under the email addresses choose which one you want as default mail address or create a new one and set that as default.
 
I'm just looking at this and the account e-mail address seems not necessarily also be the default address for the domain.
As admin, reseller or user, you should be able to login into the domain.
Then under the email addresses choose which one you want as default mail address or create a new one and set that as default.
Yes, I agree - the term "Default" here is not correct. Or at least that would be my argument.

"Default" in this context isn't really an email address, it's an action. "What does the server do with email sent to addresses that are not already defined?" It can reject them before accepting them (:fail:), it can silently discard them (:blackhole:), or it can deliver them to an email account - whether that is a real email address or a system user mailbox.

The confusion here seems to be that DirectAdmin is referring to the local OS username as being the "Default" address. This isn't really a default address - in my opinion, but maybe I'm misappropriating terms - this is a "local OS username" or system user mailbox. This mailbox can't be disabled, but you can prevent outside (non-local, i.e. not on the same server as the system user mailbox) from sending mail to this mailbox by removing the appropriate line in the domain's /etc/virtual/%domain%/alias file. This won't change the table in the DirectAdmin control panel listing of email account, but it will prevent mail from being delivered to the system user mailbox via %systemusername%@%domain%. (But outside users will always be able to send mail to this account by sending mail to %systemusername%@%serverhostname%)

You can never stop someone on the same server from sending mail to this system user mailbox. Running:

echo "Test" | mail -s "Test" %systemusername%

will always deliver mail to the %systemusername% (which is a Maildir stored at /home/%systemusername%/Maildir).

This also explains why system user mailbox can fill up with mail that the user is unaware of. Cronjobs, by default, will send any output or errors generated from running scripts or commands to %systemusername%. PHP scripts that use mail() with out defining a return-path or bounce address will default to %systemusername% as the return-path and undeliverable messages will bounce back to that mailbox.

But to call this system user mailbox the default address, I don't agree with.

There's also nothing technically stopping you from creating an email account - %systemusername%@%domain% - other than a control system within DirectAdmin that is preventing this.

I would propose the following changes:

- Remove or don't create the %systemusername%: %systemusername% line in /etc/virtual/%domain%/alias on domain creation.
- Add a single row in the Email accounts list in the User's DirectAdmin Control Panel for:
%systemusername% - system user mailbox, local mail only, can't be deleted, to check mail login with your DirectAdmin username and password
- Remove the %systemusername%@%domain% row from the table
- Add text, some where on the page, that correlates "Default mail action" to whatever *: is set to in /etc/virtual/%domain%/alias (:fail:, :blackhole:, delivered to system user mailbox, delivered to local email account, sent out to remote email address - which is a very, very bad idea)
- Remove whatever control system is preventing %systemusername%@%domain% from being a createable email account.
 
Back
Top