postfix email erver configuration

hostgliders

Member
Hosting Provider
Registered
Joined
Feb 17, 2017
Messages
51
Points
0
Some of you use postfix email server and honestly the initial configuration is simple and easy.

Here you go!!

/etc/postfix/main.cf
-------> This is the main configuration file for Postfix.

You can open this configuration file in any of your text editor like nano,vim,vi


******************
myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
relayhost =
mynetworks =
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all



*******************
This is the section of the configuration file you must focus on.

You need to configure the above sections properly!!

myhostname: This is the hostname of your machine. But don't put the full hostname. If your machine hostname is tes.sample.com you will only use sample.com.

mydestination: This parameter specifies what destinations this machine will deliver locally. The default is:

mydestination = $myhostname localhost.$mydomain localhost

You could also use something like ;

sample.com sample localhost.localdomain localhost

This call is up to you. Either way will work; but the latter line will help to avoid mailloops.

mynetworks
: This line is a bit trickier. This entry will define authorized destinations that mail can be relayed from. You would think that adding your subnet here would work. Sometimes that is the case; sometimes not. You could go with a mynetworks entry that looks like:

mynetworks = 127.0.0.1/8

The above entry is a safe entry and defines local machines only.

You could also have an entry that looks like:

mynetworks = 127.0.0.1/8 XX.XX.XX.XX/24


The above entry would authorize local machines and your internal network addresses.

I have found, however, that the above entries will cause problems with relaying due to constantly changing dhcp addresses. Because of this I have used the following, specialized entry which will avoid this issue:

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

Now, if your mail server serves up mail to your entire domain, you will need to add another entry to that section above. That entry is:

mydomain = sample.com

Again, as in all configurations above, the sample.com will be substituted with your real domain.

Now, save that configuration file and restart your mail server with the command:

sudo /etc/init.d/postfix reload

You are good to go now.
 
Older Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top