Can I create username@domain.tld usernames for existing username.domain users?

No, I don’t think you want to change the old name. Don’t change username.domain. I’m pretty sure you need it to stay the same, as it’s how Postfix identifies the user. Just add username@domain.tld with the same UID and home directory.

Wait, why would you want this?

Adding only username@domain.tld does not work. I think there is a backend created by Jamie which ties username@domain.tld to only username-domain.tld. I’ve tried now adding only the @ version with no success and then the @ and - versions without success. They show up in virtualmin but cannot be connected to the username.domain format. For how virtualmin handles it for postffix, it is either one or the other and not both. It seems that only @ in combo with - works.

OK, then I guess you just need to use sed on /etc/postfix/virtual to update the users to the user-domain format (or do it by hand, if it’s not a gazillion users).

Not really an answer to the subject, but I have yet to find a mail client that I couldn’t use “username” as the login name. Including the new win10 email and outlook 365. Just requires you slightly modify the way you set things up. For instance, Outlook 365 you create the account in control panels - mail.

Not a fix, but your initial comments are not absolutely correct.

Hi all, just imported a cpanel account and trying to get a mail client (outlook using imap) to work. The original username on cpanel was I see that postfix uses username.domain as talked about in this thread.

I’ve tried following settings:
username: user.domain
port 995
encryption method: Auto
Do i check require logon with secure password authentication?

port 25
check under my outgoing smtp server requires auth.
check under use same settings as my incoming mail server

I have confirmed ports 25 and 143 are open on my server.

No luck so far. Please advise on how to troubleshoot.
Thank you!


@dgmdev your problem is not related to this thread (I know it looks like it is from where you’re sitting, but it’s not; yours is a configuration and migration question and maybe a question about mail client configuration, while the original thread is about converting existing users to a new username format). Start a new topic.

My apologies. Will start new thread if needed.

I’ve looked at this a little closer, as I have several Office 365 users who struggle to set up accounts due to username@domain.tld requirements.

What I did to make this work is as follows:

  1. Before anything, backup your /etc/passwd, /etc/shadow and /etc/postfix/virtual
  2. Webmin -> System -> Users and Groups
  3. Search for user you wish to change
  4. Change Username to username@domain.tld
  5. Save
  6. Open up /etc/passwd
  7. Search for the email address you just modified
  8. Duplicate and change to this format: username-domain.tld
  9. Save
  10. Open up /etc/shadow
  11. Search for the email address you just modified
  12. Duplicate and change to this format: username-domain.tld
  13. Save
  14. Open up /etc/postfix/virtual
  15. Search for the email address you just modified
  16. Change the username (right hand item) to username-domain.tld
  17. Save
  18. Reload Postfix
  19. Validate Virtual servers

You can then login using username@domain.tld

Test, test, test!

1 Like

One impact to be aware of is that this will create a new user when logging into Roundcube, so certainly worth providing a migration plan there too (if your users utilise ‘Contacts’ etc.)