I want a virtual site domain1 to receive e-mail destined for domain2 hosted on another ISP.

Export to PDF | Export to DOC

Problem: I want a virtual site domain1 to receive e-mail destined for domain2 hosted on another ISP.


  1. Ensure domain2 is properly setup and all users receive e-mail.
    Have the other ISP of domain2 setup DNS for the mail server of domain2 to be domain1:

    domain2.com. in mx 30 mail.domain1.com.
    Allow a few days for zDNS to be updated on the Internet. Verify by running the following command against the ISP’s name server.

    1. First find out the ISPs nameserver by running whois domain2
    2. Check to ensure DNS is updated by running the digcommand:dig @ISPs_Name_Server domain2Verify the MX record for domain2 on the ISPs name server is mail.domain1.com
      Something like:
      . 6H IN MX 30 mail.domain1.com.
  2. Add the following custom line at the bottom of the /etc/virtusertable only if mail for user@domain2.com should go to user@domain1.com.
    If mail for user@domain2.com should go to defaultuser@domain1.com, then skip to step 4. (All mail delivered to domain1 will go to user@domain1)
    @domain2.com %1@domain1.comWhere the space between is a TAB.
    This ensures any mail sent to user@domain2.com will be sent to the user@domain1.com. (A user to user relationship)
  3. Follow this step only if you skipped to it from step 3.
    To have mail for user@domain2.com go to anotheruser@domain1.com. There will not be a user to user relationship.List @domain2 as an alias for the user in domain1 that will receive all the email.
    To do this:

    a. Use the user interface and go to Site Management for domain1.com.
    b. Click on the blue envelope button to create/modify the user’s email account.
    c. Add “@domain2.com” to the email aliases of the user. This creates a catch-all alias for the site domain2 in domain1.

  4. Run makemap hash /etc/virtusertable < /etc/virtusertable
  5. Allow domain2to use the mail server.
    1. vi /etc/mail/access
    2. Find the line in the middle: # Put custom additions below (Do not change/remove this line).
    3. Directly under the line in b add the following:
      domain2.com RELAY
  6. Run makemap hash /etc/mail/access < /etc/mail/access
  7. Restart sendmail
    Run /etc/rc.d/init.d/sendmail restart
  8. Test mail delivery by sending mail . (Note: user mailboxes are kept in /home/spool/mail)

Leave a Reply

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