Forwarding to an External Address

Add an alias to the aliases file for each user whose mail must be forwarded to another system. The recipient field of the alias entry must be a full email address that includes the host part.

After adding the desired aliases, rebuild the aliases database file with the newaliases command.

There are many reason why mail delivered to your system must then be forwarded to another host. For example, a user may have changed addresses, a user may have several addresses but only read mail at one of them, or your host might be a mail hub that collects mail for several different systems. A mail exchanger is a good example of a system that receives mail that might need to be forwarded to another host for delivery.

A mail exchanger receives mail addressed to other hosts and accepts that mail as local mail. It is possible, however, that not every user on every host that routes mail to the mail exchanger has a local account on the mail exchanger. Two sendmail -bv tests illustrate this:

# sendmail -bv deliverable: mailer local, user pat
# sendmail -bv User unknown

In the first case, pat is a user account on the mail exchanger, so the mail can be delivered directly to Pat’s local mailbox. In the second case, andy is not a local user account, so the mail is bounced with a “User unknown” error. Assume, however, that this mail should not be returned with an error because Andy is a current employee who is allowed to receive mail at the address Andy doesn’t have an account on the mail exchanger, but he does have a valid account on another system in the domain, and it is on that system that Andy reads his mail.

The “User unknown” error is solved by creating the correct aliases. For example, on our sample mail exchanger, we might add the following alias for andy:


The alias is available as soon as newaliases is run. Rerunning the sendmail -bv test that previously produced the “User unknown” error shows the following result:

# sendmail -bv deliverable: mailer esmtp, host rodent.wrotethebook.  com.,

The error is gone. Now, mail addressed to is forwarded through the esmtp mailer to Remote users do not even need to know that a host named rodent exists. They send mail to, and the mail exchanger forwards it to the correct host for delivery.