Выбрать главу

dnl #

DAEMON_OPTIONS(\QPort=smtp,Addr=127.0.0.1, Name=MTA')dnl

Add dnl to the start of this line to comment it out:

 dnl DAEMON_OPTIONS(\QPort=smtp,Addr=127.0.0.1, Name=MTA')dnl

sendmail will then accept connections on all network interfaces and deliver mail that is addressed to a user on the local host. For example, if the hostname is bluesky.fedorabook.com , then email addressed to chris@bluesky.fedorabook.com will be delivered to the mailbox of the local user chris , which is /var/spool/mail/chris .

To configure sendmail to accept mail for other destinations, add those destinations to the file /etc/mail/local-host-names :

# local-host-names - include all aliases for your machine here.

 fedorabook.commailserver.fedorabook.comglobal.proximity.on.ca

Remember to enable inbound connections on port 25 (SMTP) in your firewall configuration.

7.6.1.4. Using aliases

There are many standard email addresses that people expect to be able to use: webmaster to reach the person responsible for the web server and content, abuse to report spam problems, info as a general information contact, and so forth. Mail sent to these standard addresses can be redirected to the mailbox of chosen users through the sendmail alias facility.

Aliases are configured in the file /etc/aliases , which looks like this:

#

# Aliases in this file will NOT be expanded in the header from

# Mail, but WILL be visible over networks or from /bin/mail.

#

# >>>>>>>>>> The program "newaliases" must be run after

# >> NOTE >> this file is updated for any changes to

# >>>>>>>>>> show through to sendmail.

#

# Basic system aliases -- these MUST be present.

mailer-daemon: postmaster

postmaster: root

# General redirections for pseudo accounts.

bin: root

daemon: root

adm: root

...(Lines snipped)...

info: postmaster

marketing: postmaster

sales: postmaster

support: postmaster

# trap decode to catch security attacks

decode: root

# Person who should get root's mail

#root: marc

You'll notice that all of the standard aliases are redirected to root but on most systems, no one checks the root mailbox, so you should start by defining who is to receive mail addressed to root . Uncomment the last line of this file and replace marc with a valid user ID:

root: chris  

Run the newaliases command after each edit to the /etc/aliases file to ensure that the changes are put into effect immediately:

# newaliases/etc/aliases: 76 aliases, longest 10 bytes, 765 bytes total 

Next, change any aliases that you do not wish to redirect to root , sending the mail to the user of your choice:

info: sam

marketing: frida

sales: angela

support: henry  

Destination mailboxes do not have to be locaclass="underline"

abuse: hotline@global.proximity.on.ca  

And it's possible to specify multiple destinations for an alias, separated by commas:

webmaster: frank, jason@fedorabook.com  

This opens up the possibility of using aliases to create simple mailing lists. For example, all of your sales people could be reached through one address:

sales-team: angela, sue, mike, olgovie, george

sysadmins: nancy43252345234@hotmail.com,

scott84353534534@gmail.com, george  

Note that alias destinations can be on multiple lines.

You can create as many aliases as you want, whenever you want. Aliases are handy for creating disposable email addresses . I create batches of made-up addresses from time to time and use them when I register for a conference or web site, or when I enter a contest:

daa: chris

dab: chris

dac: chris

dad: chris

dae: chris

daf: chris

When I use one of these addresses, I record who I gave it to, and if I see spam arriving with that address, then I know who has been abusing my personal information. I can discontinue receiving mail at that address simply by removing the offending alias from the aliases file.

This strategy is also effective when publishing email addresses on a web site: simply change the address on the web site periodically, using a different disposable email address each time. If a spammer harvests your email address from the web page, it will be useful to them only for a short time.

7.6.1.5. Configuring virtual users

Aliases (and regular user accounts) have one critical limitation: they apply to all of the domains for which sendmail is accepting mail. If you have a server that is accepting mail for fedorabook.com as well as global.proximity.on.ca , and you define an alias or create a user account named chris , then mail to chris@fedorabook.com and mail to chris@global.proximity.on.ca will end up in the same mailbox.

To overcome this limitation, use the /etc/mail/ virtusertable file to define where mail to each address should be sent. Each line in this file consists of an address, a space, and the destination. Here is an example:

chris@fedorabook.com chris

chris@global.proximity.on.ca chris7895378943683897@gmail.com  

Note that the syntax for /etc/mail/virtusertable differs from the syntax for /etc/aliases: there are no colons, and only one destination address may appear in each entry.

virtusertable also permits the redirection of entire domains, by leaving out the username portion of the email address:

joe@fedorabook.com joseph

frank@fedorabook.com frank265897e93456738@hotmail.com