Red Hat Enterprise Linux at Iowa State University

Configuring Postfix for use at Iowa State

This document will allow you to configure Postfix to send mail through the central Iowa State mail server.

Assumptions

  • You have Postfix installed
  • You want to send mail through the central mail server (mailhub.iastate.edu)
  • You want your outgoing mail (with possibly a few exceptions) to end in @iastate.edu

This document will not configure Postfix to accept mail for local users --- it is possible but beyond the scope of this document.

All commands in this document should be ran as root.

Configuring Postfix to be the default Mail Transfer Agent (MTA)

Run the command /usr/sbin/redhat-config-mail and select Postfix to be the default MTA

Run the command chkconfig --level 35 postfix on to start up postfix automatically on boot up.

Configuring Postfix

The configuration files for Postfix are located in /etc/postfix/

Setting your host and domain name

In the file /etc/postfix/main.cf look for the line myhostname. If the output of the hostname command returns a fully quallified domain name (i.e., it returns something like fnord.ait.iastate.edu and not simply fnord then you can leave this line commented out. Otherwise, change it to look like:

myhostname = fnord.ait.iastate.edu

replacing fnord.ait.iastate.edu with your fully qualified domain name.

In the file /etc/postfix/main.cf look for the line mydomain and set it to look like:

mydomain = iastate.edu

In the file /etc/postfix/main.cf look for the line myorigin and make sure it is set to:

myorigin = $myhostname

Configuring where to listen for mail

In /etc/postfix/main.cf change the inet_interfaces mydestination and mynetworks lines to:

inet_interfaces = localhost
mydestination = localhost, $myhostname
mynetworks = 127.0.0.0/8

Sending through Iowa State's mail server

In /etc/postfix/main.cf set relayhost to:

relayhost = mailhub.iastate.edu

and add the following lines:

masquerade_domains = iastate.edu
masquerade_exceptions = root, mailer-daemon
masquerade_classes = envelope_sender, header_sender, header_recipient, envelope_recipient

You should add any additional local users to the masquerade_exceptions line.

Loading Configuration

Run service postfix reload to reload the configuration changes.