Setup your host name like this:
---------------------------
root@mail:~# vim /etc/hosts
===========================================
127.0.0.1 localhost
146.184.13.55 mail.server.world mail
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
============================================
For Incomming Mail:
------------------
root@mail:~# apt-get install dovecot-common dovecot-pop3d dovecot-imapd
root@mail:~# vim /etc/dovecot/dovecot.conf
# line 26: change ( if not listen IPv6 port )
listen = *
root@mail:~# vim /etc/dovecot/conf.d/10-auth.conf
# line 9: uncomment and change ( allow plain text auth )
disable_plaintext_auth = no
# line 99: add
auth_mechanisms = plain login
root@mail:~# vim /etc/dovecot/conf.d/10-mail.conf
# line 30: uncomment and add
mail_location = maildir:~/Maildir
root@mail:~# vim /etc/dovecot/conf.d/10-master.conf
# line 96-98: uncomment and add
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
root@mail:~# /etc/init.d/dovecot restart
For Outgoing Mail:
-----------------
root@mail:~# apt-get install postfix postfix-tls sasl2-bin
# select 'No Configuration' (configure manually)
root@mail:~# cp /usr/lib/postfix/main.cf /etc/postfix/main.cf
root@mail:~# vim /etc/postfix/main.cf
# line 59: uncomment
mail_owner = postfix
# line 76: uncomment and specify hostname
myhostname = mail.server.world
# line 83: uncomment and specify domain name
mydomain = server.world
# line 104: uncomment
myorigin = $mydomain
# line 118: uncomment
inet_interfaces = all
# line 166: uncomment
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# line 209: uncomment
local_recipient_maps = unix:passwd.byname $alias_maps
# line 268: uncomment and specify your LAN
mynetworks = 127.0.0.0/8, 10.0.0.0/24
# line 388: uncomment
alias_maps = hash:/etc/aliases
# line 399: uncomment
alias_database = hash:/etc/aliases
# line 421: uncomment (use Maildir)
home_mailbox = Maildir/
# line 557: make it comment and add below
# smtpd_banner = $myhostname ESMTP $mail_name (@@DISTRO@@)
smtpd_banner = $myhostname ESMTP
# line 631: add
sendmail_path = /usr/sbin/postfix
# line 636: add
newaliases_path = /usr/bin/newaliases
# line 641: add
mailq_path = /usr/bin/mailq
# line 647: add
setgid_group = postdrop
# line 651: make it comment
#html_directory =
# line 655: make it comment
# manpage_directory =
# line 660: make it comment
# sample_directory =
# line 664: make it comment
# readme_directory =
# add at the last line: limit an email size 10M
message_size_limit = 10485760
# limit mailbox 1G
mailbox_size_limit = 1073741824
# Add the following line to locate transport file
transport_maps = hash:/etc/postfix/transport
# for SMTP-Auth settings
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_client_restrictions = permit_mynetworks,reject_unknown_client,permit
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
root@mail:~# vim /etc/postfix/header_checks
# for example, reject from the addreses "*@bdjobs.com"
/^From:.*@bdjobs.com/ REJECT
root@mail:~# vim /etc/postfix/transport
--------------------------------------
nationalhousingbd.com local:
.nationalhousingbd.com local:
--------------------------------------
root@mail:~# postmap transport
root@mail:~# newaliases
root@mail:~# postalias aliases
root@mail:~# /etc/init.d/postfix restart
Stopping Postfix Mail Transport Agent: postfix.
Starting Postfix Mail Transport Agent: postfix.