Section 11.3. Mail Services

11.3. Mail Services

Email- related daemons can be put into two categories: mail transport agents (MTAs), which send new email messages to their destination machines, and mail delivery agents (MDAs), which send mail that's landed in a user's mailbox to that user 's personal computer.

11.3.1. Mail Transport Agents (Postfix)

A mail transport agent sends email to other computers, most often via the SMTP protocol. Mac OS X ships with Postfix, an improved alternative to the more common sendmail program that shipped with versions of Mac OS X before Panther.

Run Postfix only if you need to provide mail-sending services to yourself or your network. You don't need to run this service to simply send email as long as there is an SMTP server that will accept connections from your machine; most ISPs provide mail services on their own servers, for example. Try sending through mail.yourispname.com and see.


11.3.1.1. Using Postfix

You can configure Postfix to work in two ways on your machine. The first, as a local mailer, allows you to send and receive local messages, as well as send messages to external Internet addresses. This mode is useful for receiving the regular cron reports that get sent to root , for allowing scripts to send mail, and for sending quick messages from the command line using the mail command.

Postfix can also run as a standalone mail server, able to exchange mail with other servers on the Internet. Even if you don't need to run your own full-fledged mail server, this mode lets you use your regular GUI email client and send mail directly from your Mac to any Internet address, eliminating the need for you to first relay your mail through an external SMTP server. This option can be very helpful when, for whatever reasons, your ISP's server becomes unreachable.

11.3.1.2. Configuring a local mailer

By default, Mac OS X runs a program called master that monitors the outgoing mail queue and runs Postfix on the queue as needed. This daemon is controlled by the launchd script /System/Library/LaunchDaemons/org.postfix.master. plist . Without any configuration, Tiger lets you send local mail. To confirm, try sending a message to yourself:

 MacChuck:~ chuck$  mail chuck     Subject: Test     Testing...1, 2, 3     .  EOT     MacChuck:~ chuck$ 

Check local mail using the mail command by itself:

 MacChuck:~ chuck$  mail  Mail version 8.1 6/6/93.  Type ? for help.     "/var/mail/chuck": 1 message 1 new     >N  1 chuck@dhcp-172-24-31  Tue Aug  2 10:21  14/566   "Test"     &  [RETURN]  Message 1:     From chuck@dhcp-172-24-31-10.west.ora.com  Tue Aug  2 10:21:48 2005     X-Original-To: chuck     Delivered-To: chuck@dhcp-172-24-31-10.west.ora.com     To: chuck@dhcp-172-24-31-10.west.ora.com     Subject: Test     Date: Tue,  2 Aug 2005 10:21:47 -0700 (PDT)     From: chuck@dhcp-172-24-31-10.west.ora.com (Chuck Toporek)     Testing...1, 2, 3     &  q  Saved 1 message in mbox     dhcp-172-24-31-10:~ chuck$ 

However, even with local mail working, you might still have a problem passing mail to other mail servers because most require that any incoming messages be from a valid domain (one whose name resolves to an IP number). If a valid domain isn't part of your machine's hostname, you need to specify one (your ISP's, for example) in the Postfix configuration file, /etc/postfix/main.cf . Depending on your situation, you'll need to define up to three parameters. Find each in main.cf , and uncomment their lines (remove the # s) before replacing the values with your own:



# myhostname = host.domain.tld

This parameter identifies your machine to other servers. The full hostname doesn't have to be resolvable, but its domain does (e.g., domain.tld ). You'll need to define at least this parameter.



# mydomain = domain.tld

This parameter identifies the domain you're sending from, which must be resolvable. You need to define this parameter only if you're defining myorigin as well.



# myorigin = $ mydomain

This parameter serves two purposes. It's used in the from header of outgoing messages as the domain part of the sender's address, and it also gets appended to any recipient address that has no domain specified. For the second reason, then, any mail locally addressed to a simple username, such as root , is sent to root@ myorigin and not the local root account.

If you use Postfix as more than just a local mailer, and this is the desired behavior, specify a resolvable domain name for myorigin . (In most cases, this value is the same used for mydomain , so you can instead use $ mydomain as the value for myorigin .)

If, on the other hand, you want locally addressed mail to stay local, don't define this parameter, and Postfix will use the value set for myhostname in the outgoing from headers. In that case, you should use only a domain name, and not a full hostname, for myhostname 's value.

If you've made your changes while Postfix is running, execute the command postfix reload as root, and the changes will take effect without interrupting mail services.

Chapter 2 contains a list of Postfix's command-line arguments. If you need to customize your Mac's Postfix setup, you should read a good reference book on the topic, such as Postfix: The Definitive Guide (O'Reilly) or the online materials found at http://www.postfix.com.

During installation of Tiger, a script is supposed to run that creates the user accounts required by several system daemons, including Postfix. If you've performed an upgrade to Tiger, however, it's possible that this didn't happen, so starting Postfix will fail with an unknown user error. You can easily fix this by running the script manually as root. You'll find the script at /Library/Receipts/Essentials.pkg/Contents/Resources/CreateSystemUsers .


11.3.1.3. Configuring a mail server

Once you have Postfix running as a local mailer, you can then configure it to operate as a standalone mail server, which requires the services of the SMTP daemon, smtpd . As a security precaution, Postfix is configured by default with smtpd disabled so it won't accept incoming mail. However, it's not difficult to enable smtpd so Postfix can at least relay messages from a local email client.

To do this, first modify the file /etc/hostconfig so the line MAILSERVER=-AUTOMATIC- instead reads MAILSERVER=-YES- . This ensures that Postfix is running at all times to accept mail. Next, uncomment this line from /etc/postfix/master.cf :

 #smtpinetn -  n  -  -smtpd 

You can then start Postfix by running /System/Library/StartupItems/Postfix/Postfix start as root (or using restart if Postfix is already running).

Finally, configure your email client (including Apple's Mail application, Microsoft's Entourage , and Qualcomm's Eudora ) to use either localhost or 127.0.0.1 as its SMTP server. Once you do, Postfix will deliver outgoing mail from your Mac directly to your recipients' servers.

By default, Postfix is configured to accept only local connections, so you still won't be able to receive mail from the network. Allowing this involves changing the inet_interfaces and mynetworks_style parameters in main.cf . There are several ways to do this, and security considerations are involved as well, so you should have a strong understanding of the issues before putting a mail server on the network. The Postfix references mentioned previously are a good place to start.

11.3.2. Mail Delivery Agents

Most email users don't read mail directly from their mailhosts; instead, they download their mail from the host to their personal computers. A daemon running on the mailhost called a Mail Delivery Agent (MDA) facilitates this by supporting a mail-delivery protocol, and individual mail clients (Apple's Mail, for example) connect to this service to check for and download new messages.

The two most common MDA protocols are the Post Office Protocol (POP) and the Internet Message Access Protocol (IMAP). POP, the older and more commonly supported of the two, comprises a very simple command set, allowing users to do little besides download their mail and delete it from the server. IMAP represents a newer and more sophisticated protocol that lets users store and organize all their mail on the server-side. This offers much greater convenience to users, but at the cost of more server resources; consider using the quota command (see Chapter 2) to set users' storage capacities if you support IMAP.

Unfortunately, Mac OS X ships with neither popd nor imapd , the daemons that give you POP and IMAP services , respectively. You can cover both these bases by installing the UW IMAP server, available as a source code tarball (http://www.washington.edu/imap/).

If you would like to forgo compiling UW IMAP altogether, a shareware utility exists that provides a simple GUI interface allowing you to easily enable Postfix as well as the UW IMAP and POP services . Postfix Enabler is available from http://www.cutedgesystems.com/software/PostfixEnabler/.



MAC OS X Tiger in a Nutshell
Mac OS X Tiger in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596009437
EAN: 2147483647
Year: 2003
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net