Problem Description
When you have a Plesk server managing hosting and DNS for a domain, but email is hosted on an external service (such as Office 365, Google Workspace, etc.), you may encounter this error when trying to send emails from other domains on the same server:
User unknown in virtual alias tableTypical Scenario
- Plesk Server: Manages hosting and DNS for
domain.com - External Mail: Office 365/Outlook handles mailboxes for
domain.com - Problem: Other domains on the same Plesk cannot send emails to
domain.com - Cause: Postfix attempts local delivery instead of querying external MX records
Why Does This Error Occur?
Postfix (Plesk’s mail server) considers that if a domain is hosted on the server (even if only for hosting/DNS), it should deliver mail locally. This happens because:
- The domain exists in Postfix’s virtual tables (
/var/spool/postfix/plesk/virtual) - Postfix queries
virtual_alias_domainsbeforetransport_maps - It finds the domain as “local” and doesn’t query external MX records
- It attempts to find the mailbox locally and fails with “User unknown”
Diagnosis
1. Check if the domain is in the virtual tables:
postmap -q yourdomain.com hash:/var/spool/postfix/plesk/virtualIf it returns something (like “1”), the domain is registered as a local virtual domain.
2. Check the current configuration:
postconf virtual_alias_domainsIf it shows virtual_alias_domains = $virtual_alias_maps, that’s the problem.
3. Verify that external MX records are configured:
dig yourdomain.com MX +shortShould display external mail servers (e.g., yourdomain-com.mail.protection.outlook.com)
Complete Solution
Step 1: Disable Mail Service in Plesk
- Access Plesk → Websites & Domains → yourdomain.com
- Go to Mail → Mail Settings
- Select “Not configured”
- Save changes
Step 2: Configure Transport Maps
Add the domain to the transport file to force external delivery:
echo "yourdomain.com smtp:" >> /var/spool/postfix/plesk/transport
postmap /var/spool/postfix/plesk/transportStep 3: Modify virtual_alias_domains
Edit Postfix’s main configuration:
vi /etc/postfix/main.cfFind the virtual configurations section (near these lines):
virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = , hash:/var/spool/postfix/plesk/vmailboxAdd this line right after:
virtual_alias_domains =Important: Leave it empty (no value after the =). This disables the default behavior where Postfix treats all domains in virtual_alias_maps as local.
Step 4: Verify and Reload
# Verify the new configuration
postconf virtual_alias_domains
# Should display:
# virtual_alias_domains =
# Verify that transport is active
postmap -q yourdomain.com hash:/var/spool/postfix/plesk/transport
# Should return:
# smtp:
# Reload Postfix
postfix reloadStep 5: Test Sending
Try sending an email from any domain on the server to the domain with external mail. It should work correctly now.
Special Cases
If the Domain is Your Master DNS Server
If the domain (e.g., merakia.es) is used as a master DNS server with subdomains like ns1.merakia.es and ns2.merakia.es, do NOT try to remove it from Plesk tables. The virtual_alias_domains = solution is correct in this case.
If You Have Multiple Domains with External Mail
Add each domain to the transport file:
echo "domain1.com smtp:" >> /var/spool/postfix/plesk/transport
echo "domain2.com smtp:" >> /var/spool/postfix/plesk/transport
echo "domain3.com smtp:" >> /var/spool/postfix/plesk/transport
postmap /var/spool/postfix/plesk/transport
postfix reloadIf You Have Subdomains with Mail
If subdomains like subdomain.yourdomain.com also use external mail, add them to transport as well:
echo "subdomain.yourdomain.com smtp:" >> /var/spool/postfix/plesk/transport
postmap /var/spool/postfix/plesk/transportVerification That It Works
After applying the changes, send a test email and check the logs:
tail -f /var/log/maillogYou should see something like:
postfix/smtp[12345]: Connecting to yourdomain-com.mail.protection.outlook.com[X.X.X.X]:25
postfix/smtp[12345]: 1234ABCD: to=<user@yourdomain.com>, relay=yourdomain-com.mail.protection.outlook.com[X.X.X.X]:25, status=sentThis confirms that Postfix is delivering mail to external servers correctly.
Troubleshooting
Domain Still Appears in Virtual Tables
This is normal and not a problem. What’s important is that virtual_alias_domains = is empty, which makes Postfix ignore those tables for routing.
Emails Get Stuck in Queue
Check the mail queue:
mailqIf there are stuck emails, verify:
- Connectivity to external MX servers:
telnet yourdomain-com.mail.protection.outlook.com 25 - That the firewall allows outbound connections on port 25
- That your server is not blacklisted (RBL)
Error: “Relay access denied”
If you receive this error, verify that relay_domains is correctly configured:
postconf relay_domainsIt should be empty or not include the problematic domain.
Solution Summary
The key is in two fundamental configurations:
- Transport maps: Tells Postfix to use external SMTP for the domain
echo "yourdomain.com smtp:" >> /var/spool/postfix/plesk/transport postmap /var/spool/postfix/plesk/transport - Empty virtual alias domains: Forces Postfix to query transport_maps first
# In /etc/postfix/main.cf virtual_alias_domains =
With these two configurations, Postfix will stop attempting local delivery and will correctly query external MX records.
Final Configuration in main.cf
Your configuration should look like this:
# Virtual domain configuration
virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = , hash:/var/spool/postfix/plesk/vmailbox
virtual_alias_domains =
# Transport maps for external domains
transport_maps = hash:/var/spool/postfix/plesk/transportImportant Notes
- ✅ This configuration does NOT affect other domains with mail in Plesk
- ✅ You do NOT need to remove the domain from Plesk
- ✅ Domain hosting and DNS continue working normally
- ✅ Only changes the behavior of mail routing
- ⚠️ Make sure to backup
main.cfbefore modifying it
Applicable to: Plesk Obsidian, Postfix 3.x





