Tidbits | Jan. 2, 2006

Sendmail Virtual User Trick

by Frank Wiles |   More posts by Frank

One of the things people find difficult about Sendmail is virtual users. These are defined in the virtusertable file ( usually in /etc/mail/virtusertable ). This file instructs Sendmail to translate a "virtual" user into a real user or alias. The reason I mention aliases here is because, with Sendmail, you can have a virtual user that translates into a alias for multiple local and/or remote E-mail accounts.

A situation some people run into is that they want all usernames at domain2.com to be delivered to the same username at domain1.com , except for a few users.... If you really wanted all users to map to the other domain it would be as simple as adding the domain into the local-host-names. It is the need to have most users map to the other domain where the virtusertable file comes in handy. For this example, let's assume that we want all users names @domain1.com except for postmaster, webmaster, and support to map to the same username @domain2.com this would be accomplished by adding domain2.com to the local-host-names file to tell Sendmail that we wish to receive mail for that domain and then adding the following to the virtusertable file:

postmaster@domain2.com: mailadmin@example.com
webmaster@domain2.com: webmsater@example.com
support@domain2.com: support@example.com
@domain2.com: %1@domain1.com

The first three lines tells Sendmail to send messages sent to those three usernames at domain2.com to the appropriate remote E-mail addresses. The last line instructs sendmail to send any other usernames sent to domain2.com to the same username at domain1.com. Note that this will also include any fake usernames that a spammer might send to. The E-mail server at domain1.com will still be responsible for determining what is or is not a valid username. After you've added those entries to the virtusertable file all you need to do is rebuild it and it becomes active.


Featured Posts   E-mail   open source  

{% else %}

2006-01-02T08:00:00 2018-04-18T15:58:46.042892 2006 Featured Posts,E-mail,open source