What is Postfix, How to Install and Configure Postfix Mail Server ?

What is Postfix Configure Postfix Mail Server

What is Postfix ?
Postfix is a open source mail transfer agent. Postfix is used to route and deliver mail.

Default port of postfix 25.

There are three type of mail agent used.
    MUA - Mail User Agent
    MTA - Mail Transfer Agent
    MDA - Mail Delivered Agent
MUA - Mail User Agent used to send mail from one system to another system on a local area network on internet. Like postfix mail server.
MTA - Mail Transfer Agent is used for filtering between MUA and MTA. It filter a data (mails) that is spam or not. Exm:- procmail , spam session.

Protocol used in mail server
    SMTP - (simple mail transfer protocol) It used to send mail from one mail server to another mail server.
    POP3 - (post office mail) It used to download and delete mails from mail server.
    IMAP - (internet message access protocol) It used to read, delete, manage mail server.

Install and configure postfix mail server.
First of all we need to install package.

# yum install postfix
# yum install dovecot
# yum install telnet

Then open postfix configuration file.

# vim /etc/postfix/main.cf
myhostname = yourdomain.com
mydomain = domain.com
myorigin = $mydomain
inet_interfaces = all
mynetworks = 192.168.2.0/24, 127.0.0.0/8
mydestination = $myhostname, $mydomain, localhost
home_mailbox = Maildir/

We need to do some entry in config file. 
Then open dovecot config file.

# vim /etc/dovecot/dovecot.conf

Then we need to do some entry dovecot config file.       

protocols = lmtp imap pop3
home_location = maildir:~/Maildir

Then start both services Postfix or Dovecot

# systemctl start postfix
# systemctl start dovecot
# systemctl stop firewall

We need to stop firewall.   
(u can stop firewall only postfix service)

Now we check it’s work or not

We need to add two user one is sending mail or second is receiving mail.

# useradd testuser1
# useradd testuser2
# passwd testuser1
# passwd testuser2

Here we are using telnet to send mails.

# telnet 192.168.2.1 25                     (25 smtp port)
  mail from: testuser1@yourdomain.com
  rcpt to: testuser2@yourdomain.com
  data
  (then write a message u want to send)
  this is hostingride mail server
  .   (type (dote) to end)
  quit

Now we check mail received or not on client PC.             

# telnet 192.168.1.1 110        (110 pop3 port)
  user testuser2
  pass testuser2
  list
  Retr 1
  This is hostingride mail server.

Note: - Basic Command You should Know

Check all uncomment file in config file        

 # postfix -n

To access mail throught webmail we are using SQUIRRELMAIL

Check syntax of postfix configration.

# postfix check  

To check log file details.

# tail -f /var/log/maillog

To display list of all queued mails.

#  postqueue -p

Tell postfix to process all the queue now.

 # postqueue -f

To delete mails from queue in postfix.

# postsuper -d ALL
Blog type: 

Comments

great explain, worked for me ! many thanks

Pages

Add new comment

Authored By

Sandeep Gurjar

Hy all, This is Sandeep Gurjar am the founder of hostingride.in. I am a Redhat Certified Engineer (RHCE) / AWS Solutions Architect-Associate and working as an system administrator since 2016.

Follow us on

Facebook​  Twitter  LinkedIn  Google+