macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Configuring sendmail on Jaguar
Pages: 1, 2, 3, 4, 5

Setting Up the LUSER_RELAY

The next setting we are going to look at is the LUSER_RELAY. No, this doesn't mean a way to deal with those 14 year old kids who hold their hands up to their foreheads saying "loooooos-errrr", but instead is a way of handling email that comes to your server that is not addressed to any user. The LUSER_RELAY setting will direct any piece of mail to your server without a user to a particular user's account.



This is particularly handy when you want to be able to hand out lots of different addresses, such as im-a-geek@myhost.com and spam-target@myhost.com, without having to set up anything on your server. I personally use this feature all the time when giving my email address out to stores that I'm interested in getting email from, but fear that they will sell the address off or pummel me with too much information later.

So, to set this up, simply edit the config.mc file as follows (the bold line is the line where you will add-replace duncan with the name of the local user you want to get the mail!):

% sudo emacs /etc/mail/config.mc

VERSIONID(`$Id: generic-darwin.mc,v 1.3 2002/04/12 18:41:47 bbraun Exp $')
OSTYPE(darwin)dnl
DOMAIN(generic)dnl
undefine(`ALIAS_FILE')
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')
define(`confDONT_BLAME_SENDMAIL', `GroupWritableDirPathSafe')
define(`LUSER_RELAY', `local:duncan')
FEATURE(`smrsh',`/usr/libexec/smrsh')
FEATURE(local_procmail)
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable')dnl
FEATURE(`genericstable', `hash -o /etc/mail/genericstable')dnl 
FEATURE(`mailertable',`hash -o /etc/mail/mailertable')dnl
FEATURE(`access_db')dnl
MAILER(smtp)
MAILER(procmail)

Now, just run the update script:

% sudo ./update
Regenerating sendmail.cf
Restarting mail services

Try things out. Use your mail client to send mail to all sorts of addresses on your machine that don't exist. When you get tired of getting mail from one of your addresses, use procmail to filter it out. You can read more about how to use procmail in Dru Lavigne's article (Filtering Spam with Procmail). Procmail is already installed and ready to go on your system - all you need to do is define a ~/.procmailrc file. Or if you don't want to do that, you can use the filtering capabilities of your mail client to filter out unwanted email.

Setting Up Aliases

Our next stop on the tour is to look at aliases. An alias lets you define that mail to an address actually gets sent to somebody else. That other person might be a user on the local machine or might be an email address on a completely different system.

If you were observant while editing the config.mc file, you'll have noticed the undefine(`ALIAS_FILE') statement. To enable aliases, we'll need to edit this line to match the following:

% sudo emacs /etc/mail/config.mc

VERSIONID(`$Id: generic-darwin.mc,v 1.3 2002/04/12 18:41:47 bbraun Exp $')
OSTYPE(darwin)dnl
DOMAIN(generic)dnl
define(`ALIAS_FILE', `/etc/mail/aliases')
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')
define(`confDONT_BLAME_SENDMAIL', `GroupWritableDirPathSafe')
define(`LUSER_RELAY', `local:duncan')
FEATURE(`smrsh',`/usr/libexec/smrsh')
FEATURE(local_procmail)
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable')dnl
FEATURE(`genericstable', `hash -o /etc/mail/genericstable')dnl 
FEATURE(`mailertable',`hash -o /etc/mail/mailertable')dnl
FEATURE(`access_db')dnl
MAILER(smtp)
MAILER(procmail)

Remember to run the update script:

% sudo ./update
Regenerating sendmail.cf
Restarting mail services

Now, we'll set up some aliases. The format of the aliases file is simple. Each line in the file is composed of a local address name followed by one or more local or remote addresses to send the message to. For example, my aliases file might look something like the following:

% sudo emacs /etc/mail/aliases

root:           duncan
friend:         someone@somewhere.com
party:          duncan, john@doe.com

The first line routes mail to root@host to user duncan. The second routes mail from afriend@host to someone@somewhere.com. The third routes mail from party@host to user duncan and to john@doe.com.

In order to get sendmail to use these,aliases we need to execute the newaliases command.

% sudo newaliases
/etc/mail/aliases: 3 aliases, longest 26 bytes, 68 bytes total

This command compiles the aliases into a database file, /etc/mail/aliases.db. Sendmail does this for performance reasons -- on a low volume site, the additional overhead of parsing a text file would be negligible, but sendmail runs some of the largest mail systems on the Internet. Under heavy load, this little tweak matters a great deal.

You can add as many lines to this file as you want. Use aliases to create group mailing lists, lists for work teams, or just lists to arrange parties.

Oh, and one thing to keep in mind: Sendmail is compiled so that it will look in NetInfo (under the /aliases folder) for aliases, then the /etc/mail/aliases file. If there is an alias defined in NetInfo, it will mask an alias by the same name in /etc/mail/aliases.

Pages: 1, 2, 3, 4, 5

Next Pagearrow