Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk12 min

How to Set Up Postfix for Multiple Domains

Learn how to host several domains on one Postfix server using virtual alias or virtual mailbox domains, with complete configuration examples and a testing checklist.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To host several domains on one Postfix server, classify each hosted domain as either a virtual alias domain (addresses forward to another address or UNIX account) or a virtual mailbox domain (each address has its own mailbox). Declare every domain in the matching virtual_alias_domains or virtual_mailbox_domains parameter, maintain a recipient map, rebuild file-backed maps with postmap, reload Postfix, and test both valid and unknown recipients.

Do not add hosted virtual domains indiscriminately to mydestination. That parameter is for the server’s canonical local destinations; putting an alias-only domain there can change address-class selection and produce loops, local-delivery errors, or unexpected relay behavior.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the delivery model before editing Postfix

The first decision is whether an address needs an independent mailbox. Postfix exposes two virtual-domain address classes for this purpose. A virtual alias domain rewrites envelope recipients to local accounts or remote addresses. A virtual mailbox domain accepts named recipients and delivers each one to a separate mailbox path or to another mailbox service.

Question Virtual aliases Virtual mailboxes
What does the domain represent? A set of forwarding or UNIX-account aliases. A domain with individual virtual users and mailboxes.
Typical recipient map Full address followed by a local or remote destination, such as [email protected] joe. Full address followed by a mailbox location, such as [email protected] example.com/info.
Where is mail delivered? To a UNIX account, another local address, or a remote address. By the virtual(8) delivery agent, or through a configured LMTP/pipe transport.
How are unknown recipients controlled? By the aliases that exist in the virtual alias map; avoid an unrestricted catch-all. By entries in the virtual mailbox map and the recipient-acceptance policy.
Best fit Forwarding, role addresses, and a small set of addresses that share existing local accounts. Separate storage, quotas, or credentials for users in one or more hosted domains.

You can use both classes on one server, but a particular hosted domain should have one deliberate destination classification. Keep the recipient data source—flat files, SQL, LDAP, or another supported map—consistent with the way the domain is operated.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Prepare DNS, identities, and storage

Point each domain at the mail service

Before changing Postfix, make sure the MX record for every hosted domain points to this server or to the intended front end. An MX record that still points elsewhere will prevent an external sender from reaching the new configuration, while a correct MX record cannot compensate for a domain that Postfix has not declared as a destination.

Inventory the addresses you will accept

List the real recipients for every domain. Decide which addresses forward, which are local UNIX-account deliveries, and which require independent mailboxes. This list becomes the source map that controls recipient acceptance. It also lets you test a known address and an intentionally invalid address later.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a mailbox owner and directory

For direct virtual delivery, choose a mailbox base directory and a dedicated numeric UID and GID. The official example uses /var/mail/vhosts, a minimum virtual UID of 100, and static UID and GID values of 5000. Those numbers are example configuration values; verify that the account and filesystem permissions on your host match your own policy before delivering mail.

Option A: configure virtual alias domains

Virtual aliases are appropriate when an address should forward to another recipient rather than own a separate mailbox. The aliasing operation applies to envelope recipients. It is separate from the traditional aliases(5) table, which applies only to local recipients.

1. Declare the hosted alias domains and map

Add the domains and a file-backed map to /etc/postfix/main.cf:

virtual_alias_domains = example.com example.net
virtual_alias_maps = lmdb:/etc/postfix/virtual

Replace the example names with the domains you actually host. If your Postfix build uses a different map backend, use that backend’s supported map type instead of changing the address-class model.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Add recipient mappings

Edit the source file at /etc/postfix/virtual. The left side is the complete envelope address; the right side can be a local account or a remote address:

[email protected] postmaster
[email protected]       joe
[email protected]      [email protected]

In this example, mail for [email protected] is delivered to the local postmaster account, mail for [email protected] goes to the local joe account, and mail for [email protected] is rewritten to the remote address.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

3. Build the indexed map and reload

  1. Edit the source map and save it.
  2. Build or rebuild its indexed database with postmap /etc/postfix/virtual.
  3. Reload the running service with postfix reload.

Postfix reads the indexed result for a file-backed map; editing only the text file without running postmap leaves the running lookup data stale.

4. Treat catch-all aliases as a deliberate exception

A catch-all can receive mail for every otherwise unknown address in a domain. The official virtual-domain guidance warns that this is likely to attract spam and bounces generated for forged sender addresses. Define only the addresses you intend to accept unless you have a specific operational reason and a plan for the resulting volume.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Option B: configure virtual mailbox domains

Use virtual mailbox domains when [email protected] and [email protected] must be separate recipients with separate storage or account management. The following is the direct-delivery pattern shown in the official Postfix example.

1. Add the mailbox-domain parameters

In /etc/postfix/main.cf, configure the domains, base path, recipient map, ownership, and optional alias map:

virtual_mailbox_domains = example.com example.net
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_maps = lmdb:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_alias_maps = lmdb:/etc/postfix/virtual

The alias map is useful for role addresses or alternate addresses that should resolve to a mailbox recipient. It is not a substitute for the mailbox map: the mailbox map determines which virtual recipients are accepted and where direct delivery goes.

2. Map each full address to a mailbox location

Create the source file used by virtual_mailbox_maps, for example /etc/postfix/vmailbox:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[email protected]  example.com/info
[email protected]  example.net/sales/

The path is relative to virtual_mailbox_base. Consequently, these entries resolve beneath /var/mail/vhosts. The trailing slash in the second example is part of the mapped value and indicates the mailbox-directory form used by the configuration.

3. Build the mailbox map

  1. Save the source file.
  2. Run postmap /etc/postfix/vmailbox.
  3. Ensure the resulting mailbox directories are owned and permissioned for the configured virtual UID and GID.
  4. Reload Postfix after the configuration and map changes.

The virtual(8) delivery agent performs the recipient lookup and delivers according to the mapped location. A missing map entry should not silently become an accepted mailbox; use the map as the acceptance boundary for real users.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Delegate mailbox delivery to LMTP or another service

Postfix does not have to write message files itself. If another mailbox store owns delivery, retain a virtual mailbox map as the recipient-acceptance layer and configure virtual_transport for the service that performs final delivery. Common designs use an LMTP client or a pipe service defined in master.cf.

This arrangement separates two jobs: Postfix decides whether the full recipient address exists, and the downstream mailbox service decides how to store, index, filter, or expose the message. Confirm that the transport is defined and reachable before accepting production mail; otherwise Postfix may queue messages while the downstream service is unavailable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep destination classes mutually understandable

What belongs in mydestination

mydestination identifies canonical machine domains and other destinations delivered by the local delivery class. It is not the general-purpose list for every domain hosted by the server.

What belongs in virtual-domain parameters

Put alias-only hosted domains in virtual_alias_domains and mailbox domains in virtual_mailbox_domains. Postfix treats a domain as a final destination when it matches mydestination, a local or proxy interface, virtual_alias_domains, or virtual_mailbox_domains. The matching class determines which recipient lookup and delivery rules apply.

Why a second domain is rejected or loops

  • Relay access denied: the new domain is not recognized as a final destination, or relay policy is being evaluated before a valid virtual-domain declaration.
  • Loop-back or repeated delivery: the domain was placed in an inappropriate destination class, commonly mydestination, or a rewrite points back to the same address.
  • Unknown user: the domain is declared, but the complete recipient address is absent from the alias or mailbox map.
  • Stale behavior after an edit: the source map changed but its indexed database was not rebuilt, or Postfix was not reloaded after a configuration change.
  • Wrong backend result: the configured map type, database path, permissions, or external lookup service does not return the address Postfix is querying.

Understand how Postfix selects the class

Destination classification happens before final delivery. Postfix first determines whether the recipient domain is one of the server’s final destinations. A match in mydestination, a local or proxy interface, virtual_alias_domains, or virtual_mailbox_domains selects a final-destination path; the selected class then determines which recipient map and transport are consulted.

For that reason, do not list the same hosted domain in both virtual-domain parameters, and do not duplicate it in mydestination merely to make it “local.” A mailbox domain can use virtual_alias_maps for alternate or role addresses, but its primary recipient acceptance still comes from virtual_mailbox_maps. Conversely, an alias domain does not become a mailbox domain just because its destination happens to be a local UNIX account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remember that virtual aliasing rewrites the envelope recipient. It does not rewrite message headers and it does not replace the local aliases(5) database. This distinction matters when tracing a message: inspect the SMTP envelope address and the map lookup, rather than relying only on the visible To: header.

Use map queries to isolate configuration errors

Check representative addresses before sending test mail. For a file-backed map, query the indexed database directly:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
postmap -q [email protected] lmdb:/etc/postfix/virtual
postmap -q [email protected] lmdb:/etc/postfix/vmailbox

The first query should return the alias destination when the alias configuration is in use. The second should return the mailbox path for the virtual mailbox configuration. A blank result means that the address is not present in that map; it is not evidence that DNS or SMTP connectivity is broken.

For SQL, LDAP, or another supported backend, use that backend’s normal verification method and confirm that the lookup key is the full address in the same case and format that Postfix receives.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Maintain source maps and generated maps separately

Treat the human-edited file as the source of truth and the indexed database as a generated artifact. Keep the source under your normal configuration-change process, review additions and deletions, and rebuild the corresponding map after every edit. Rebuilding only one of several changed maps can create confusing results when aliases and mailbox acceptance are split across files.

Check the path and permissions Postfix uses for each map. A syntactically correct entry in an unreadable file behaves like a missing recipient at delivery time. For SQL or LDAP, the equivalent failure is an unavailable service, an incorrect query key, or credentials that no longer permit lookups. Verify representative addresses before reloading and again after a backend change.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Activation and end-to-end testing checklist

  1. Verify DNS: check that each hosted domain’s MX record points to the server or intended front end.
  2. Check classification: confirm that every domain appears in the appropriate virtual-domain parameter and is not accidentally duplicated in mydestination or another conflicting class.
  3. Validate the source data: inspect the alias or mailbox source file for complete addresses, correct destinations, and accidental whitespace or typos.
  4. Rebuild file maps: run postmap for every changed file-backed map.
  5. Inspect effective settings: run postconf -n and look for unintended overlap, an incorrect map path, or relay settings that do not match the server’s role.
  6. Run the configuration check: execute postfix check and correct reported ownership, directory, or syntax problems.
  7. Reload: run postfix reload after changes to main.cf, master.cf, or the maps used by the active configuration.
  8. Test a valid recipient: send one message to a known address in every hosted domain and verify the expected local, remote, mailbox, LMTP, or pipe destination.
  9. Test an invalid recipient: send to an intentionally nonexistent address in each domain and confirm that Postfix rejects or handles it according to your recipient policy rather than accepting it as an accidental catch-all.
  10. Inspect queue and logs: check queue status and mail logs for the recipient class selected, map lookup result, delivery transport, and any downstream connection failure.

Operate multiple domains safely

Keep recipient policy explicit

Virtual aliases rewrite envelope recipients; they do not by themselves provide a complete policy for authentication, content filtering, or sender-domain authentication. Limit accepted addresses to those represented in your maps unless a documented catch-all requirement outweighs its spam and backscatter costs.

Separate forwarding from mailbox ownership

Forwarding to a remote address transfers responsibility for final delivery to another system. The alias mechanism only rewrites the envelope recipient. SPF, DKIM, DMARC, and the behavior of the forwarding path must be designed separately for your deployment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Plan TLS and identity settings independently

The virtual-domain configuration does not prescribe one certificate strategy, DNS provider, DKIM signer, DMARC policy, database, or mailbox application. Choose those components according to the domains, clients, and downstream service you operate, and document which system owns each function.

Scale the recipient data source deliberately

Flat files are straightforward for a small, stable address set. SQL, LDAP, or another supported map can centralize management as domains and users grow, but the same principles remain: classify the domain once, query the complete recipient address, reject unknown users deliberately, and verify the lookup independently before reload.

A compact configuration pattern

A forwarding-only deployment can be reduced to the following operational sequence:

  1. Declare the hosted names under virtual_alias_domains.
  2. Put each accepted full address and its local or remote destination in the virtual alias source file.
  3. Run postmap on that file.
  4. Run postfix check, inspect postconf -n, and reload.
  5. Test one mapped and one unmapped address per domain.

A per-user mailbox deployment follows the same sequence but uses virtual_mailbox_domains, virtual_mailbox_maps, a mailbox base and ownership policy, and either direct virtual(8) delivery or a configured virtual_transport.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What to remember when adding the next domain

  • Decide whether the new domain needs aliases or independent mailboxes before editing configuration.
  • Declare it in the matching virtual-domain class, not merely in mydestination.
  • Use complete recipient addresses in the map and rebuild every changed file-backed map with postmap.
  • Reload Postfix, then test a real recipient and an unknown recipient while watching queue status and logs.
  • Keep forwarding, TLS, DKIM, DMARC, storage, and external mailbox services as separately owned deployment decisions.

Frequently Asked Questions

How do I host several domains on one Postfix server?

Declare each domain in exactly one appropriate virtual-domain class: use virtual_alias_domains for forwarding or UNIX-account aliases, or virtual_mailbox_domains for independent mailboxes. Populate the matching recipient map, rebuild file-backed maps with postmap, reload Postfix, and test a valid and invalid recipient in every domain.

What is the difference between a virtual alias domain and a virtual mailbox domain?

A virtual alias domain rewrites envelope recipients to a local account or another address. A virtual mailbox domain accepts named recipients and delivers each to its own mailbox path or to a delegated mailbox service such as LMTP. The mailbox map controls which users exist; an alias map alone does not create independent mailboxes.

Why does Postfix reject mail for my second domain?

The domain may not be declared as a final destination, may be listed in a conflicting class, or may lack a complete recipient-map entry. Check postconf -n, ensure the domain is in the correct virtual-domain parameter and not improperly in mydestination, query the map with postmap -q, then reload after rebuilding any changed file-backed map.

Do I need to run postmap after every edit?

Run postmap after each edit to a file-backed source map such as /etc/postfix/virtual or /etc/postfix/vmailbox. SQL, LDAP, and other external maps have their own update process, but you should still verify representative lookups before reloading.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use a catch-all for a hosted domain?

You can, but the official virtual-domain guidance warns that catch-alls attract spam and bounces for forged sender addresses. Explicit recipient entries are safer unless you have a documented operational need and a plan for the additional volume and backscatter.

Should virtual domains also be listed in mydestination?

No. Keep canonical machine domains in mydestination and put hosted alias domains in virtual_alias_domains or mailbox domains in virtual_mailbox_domains. Duplicating a hosted domain can select the wrong delivery class, cause loops, or produce local-delivery and relay errors.

The Bottom Line

Multiple domains work reliably on one Postfix server when each domain is assigned to the correct virtual address class, every accepted recipient is represented in an up-to-date map, and the configuration is checked, reloaded, and tested after each change.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.