4.5. Sending EmailBy default, mail on Fedora Core 4 is handled by the sendmail program. sendmail can be configured to perform very complicated tasks, like running all the email for a company or an ISP. Entire books can (and have) been written about it. However, you're unlikely to want to make your LAMP server double as your mail server, and you're already likely to have a mail server. Some services on your LAMP server will generate email; for example, if a cron job fails, it will often email a description of its error to root@localhost, the root user's account's mailbox. That mail needs to be read, sometimes urgently, and it would be a pain to have to log in to your server to do so. The best approach is to ensure that all mail that goes to your Web server is sent to an address at which the system administrator can read it. We'll set up the Web server so that all the mail it receives is forwarded automatically to another email address. 4.5.1. The aliases FileMail direction is controlled by the file /etc/aliases, which is shown below. /etc/aliases
Each line in this file is an email alias; the line postmaster: root means "if mail comes to the postmaster account, put it in root's mailbox." By default, Fedora's aliases file ensures that mail for all the "system" accounts on the machine (i.e., all the accounts that the computer creates, rather than the ones that you create) goes to root's mailbox. This is very useful, because then, all you have to do is ensure that the mail that's sent to root ends up in the administrator's mailbox. This is a two-step process. First, record in the aliases file that root's mail should go to the administrator's mailbox. To do so, uncomment the last line in /etc/aliases, and change marc to the administrator's email address. /etc/aliases (excerpt)
Second, tell sendmail that the aliases file has changed by running the command newaliases: [kermit@swinetrek ~]$ su Password: [root@swinetrek kermit]# newaliases /etc/aliases: 77 aliases, longest 16 bytes, 785 bytes total [root@swinetrek kermit]# exit exit [kermit@swinetrek ~]$ That's all that's required. From now on, any mail that's sent to root by any cron jobs (or similar) on your Web server will end up in your mailbox. If you've created additional accounts on your server (say, for individual system administrators), then you may wish also to add those accounts to /etc/aliases, making them forward their mail to root or other email addresses. Remember to run newaliases after you make the change. /etc/aliases (excerpt)
|