Monday, May 20, 2013
Configure Your Linux Server as Postfix Mailing gateway in step by Step
Set Up Postfix as Email
server Step by step:
1 For this tutorial I have used following software:
I OS- Linux Cent OS 5.4
II. Fetch mail 6.3 to
retrieve email from remote server
III Postfix 2.3.3 as
MDA
IV Dovecot /IMAP
V Squirrelmail as webmail
VI MS Outlook as email clinet program
Step-I .Install Redhat Enterprise Linux or Centos then
install above listed package as explained below
[root@satishmalanch ~]# yum install postfix
[root@satishmalanch ~]# yum install fetchmail
[root@satishmalanch
~]# yum install dovecot
[root@satishmalanch ~]# yum install squirrelmail
If you are not able to install squirrelmail with yum then
you can download it from http://squirrelmail.org/
and detail procedure to install is also mentioned.
Now in my scenario my server IP will be 192.168.0.100 and it
will retrieve the email from an external server
mail.satishmalanch.org.My local host name is mail.satishmalanch.local
My domain name is :satishmalanch.local
Step II Edit main.cf file
Insert following code in /etc/postfix/main.cf
#------------------------------Satish
Kr Malanch Code begin here------------------------
myhostname =
mail.satishmalanch.local
mydomain =
satishmalanch.local
myorigin = $mydomain
mydestination =
$myhostname, localhost.$mydomain, localhost, $mydomain
relay_domains =
$mydestination
#configuration for
SMTP authentication
#relayhost =
[mail.shardamotor.com]
#smtp_sasl_auth_enable
= yes
#smtp_sasl_security_options
= noanonymous
#smtp_sasl_password_maps
= hash:/etc/postfix/sasl_passwd
canonical_maps = hash:/etc/postfix/canonical
virtual_alias_maps =
hash:/etc/postfix/virtual
smtp_generic_maps =
hash:/etc/postfix/generic
home_mailbox =
Maildir/
mynetworks =
192.168.0.0/24, 192.168.6.0/24,127.0.0.0/8, 172.168.0.0/24, 172.168.20.0/24,
172.168.21.0/24,
relayhost = mail.satishmalanch.org
#------------------------------Satish
Kr Malanch Code code end here------------------------
Step-III: Now create a file
sasl_passwd and enter mail server address username and password then save
Vim /etc/sasl_passwd
mail.satishmalanch.org
username@satishmalanch.org:password
This is For authentication
to external server
Step-IV Open /etc/postfix/canonical and enter
@mail.satishmalanch.local
@satishmalnahc.org
Step-V Open
/etc/postfix/generic and enter
@mail.satishmalanch.local
@satishmalnahc.org
Step-VI Open
/etc/postfix/virtual
User1@satishamalnch.org
user1
User2@satishamalnch.org
user2
Now on terminal
enter following commands:
postmap hash:/etc/postfix/canonical
postmap hash:/etc/postfix/generic
postmap hash:/etc/postfix/virtual
postmap hash:/etc/sasl_passwd
Step-VIITo retrieve mails from external server create a fetchmail
file
Vim /home/mail_admin/fetchmailrc
poll mail.satishmalanch.org
proto pop3
user "user1@satishmalanch.org"
pass "passwordofuser1"
is user1
user "user2@satishmalanch.org"
pass "passwordofuser2"
is user2
save and exit
Step-VIII[root@satishmalanch]# chmod 600
.fetchmailrc
Now Schedule fetchmail to run every minute with
a cron job
Enter
Step-IX[root@satishmalanch]# crontab -e
0-59 * * * * fetchmail -v -f '/home/mail_admin/.fetchmailrc'
&>/home/mail_admin/incoming.log
Save and exit
From above job fetchmail will reterive mails and will send
output to incoming.log file
Now you have configured postfix server.Just restart all the
required services with commands
[root@satishmalanch]# /etc/init.d/postfix/restart
[root@satishmalanch]# /etc/init.d/dovecot
restart
Step-X To access mail from webmail you can enter url
http;//yourserverip/webmail
You can configure setting with outlook or any
other client.
To check downloading mails:
[root@satishmalanch]# tailf /home/mail_admin/incoming.log
Subscribe to:
Posts (Atom)