March 3, 2009

How to: Configure postfix on CentOS 5

If you have not installed postfix, then install it as follows:

# yum install postfix

Configuration files are in /etc/postfix directory.

To configure postfix

  1. # vi /etc/postfix/main.cf
  2. Uncomment and modify myhostname to your computer name
    #myhostname = host.domain.tld
  3. Uncomment and modify the following to your domain name or to your IP address
    #mydomain = domain.tld
  4. Uncomment the following:
    #myorigin = $mydomain
  5. uncomment and comment the following directives:
    #inet_interfaces = all
    inet_interfaces = localhost
    
  6. The changes will be as follows:
    inet_interfaces = all
    #inet_interfaces = localhost
    
  7. Uncomment and modify mynetworks to points to your net work IP address:
    #mynetworks = 168.100.189.0/28, 127.0.0.0/8
  8. # chkconfig postfix on
  9. # service postfix start

If you have installed and configured both sendmail and postfix, do not start them at the same time. Only one should be started.For example,

service sendmail stop
service postfix start

To switch between the two electronic mails, use one of the following commands:

# system-switch-mail
# alternatives --config mta

To send mail to another user,use the mail command.

  1. # mail root
  2. Type the message in the Subject field
  3. when you are done, press CTRL-D
  4. Enter another address in the Cc field
  5. Press Enter to send the message.
# mail root
Subject: This is a test.....
Cc: 
Null message body; hope that's ok

To read message 1

# mail
& 1

d command deletes the message

q command quit from the mail program

RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)

Spread the word

del.icio.us Digg Furl Reddit Help

Permalink • Print

Related Entries

Made with WordPress and an easy to customize WordPress theme • Sky Gold skin by Denis de Bernardy