Category: Postfix

Setting up a basic Postfix Mail Server

By peter, September 11, 2009

The following is based on SuSE 10.2

The most popular mail program at the moment is “Postfix”.

Make sure that you have installed the following:

1) Postfix – for sending and receiving mail to your server)

2) qpopper – to allow users to collect mail from your server. (SuSE 11 doesn’t include qpopper, search for another pop utility/program instead)

Setting up Postfix

qpopper:
Vi the /etc/xinetd.d/qpopper file and change setting to “disabled = no”

edit the /xinetd.d/qpopper file

edit the /xinetd.d/qpopper file




Postfix:

Vi the “/etc/sysconfig/mail” file and change “SMPTD_REMOTE_LISTEN = YES”

Vi the “/etc/sysconfig/postfix” file and change the following:
“POSTFIX_LOCALDOMAINS” and add in the domain names you will receive. Eg below

POSTFIX_LOCALDOMAINS=”yourdomain.co.za”

set the “POSTFIX_BASIC_SPAM_PREVENTION” to “medium” eg follows:

POSTFIX _BASIC_SPAM_PREVENTION=”medium”

If you are using a dialup modem, then you will need to set the “POSTFIX_DIALUP” to “yes” and “POSTFIX_NODNS” to “no”.
You might need to edit the “/etc/postfix/main.cf” file as well and check some of the settings like “myhostname” if you are receiving for yourdomain.co.za and not for computername.yourdomain.co.za. Also check things like “mydestination” and put in all the domains for which you receive mail.

Restart “xinetd” and “postfix”. Restarting xinetd will allow qpopper to become active

Testing

Go into the “Shell”
Type “telnet your_server_ip_address 25” (25 is the smtp port)
Type”telnet your_server_ip_address 110” (110 is the pop3 port)
If you connect, your mail is working!

For trouble shooting, if something isn’t working correctly, view the log files. This will help you to determine why something isn’t working correctly

TIP

To see the log, type the following into the shell:

tail /var/log/mail

to see the log as it happens type the following:

tail -f /var/log/mail

For general messages “tail -f /var/log/messages”

The mail queue
Sending
If the mail is either delayed while waiting for a modem connection, or you have set “defer_transports = smtp” then your mail will be waiting in a mail queue. You can see the content of the mail queue by typing the command “mailq” at the command prompt.

To send queued mail use the “sendmail -q” command.

Receiving
Unless your “mx” record is pointing to your static IP address, then you are going to have to use “fetchmail” to receive mail.

vi the “/root/.fetchmailrc” file similar to the following example:

poll 192.168.114.3 protocol pop3 username peterh password 3ry691+ is peterh

poll 192.168.114.3 protocol pop3 username thabangs password hfs065( is thabangs

Notice the format:

poll mail server protocol pop3 username “username” password “password” is local user
Set a con job to run “fetchmail -a” at the desired intervals
You will need to change permissions on the “.fetchmailrc” file to at least “0710″ as follows:
chmod 0710 .fetchmailrc

Test by typing “fetchmail -v -a” at the command prompt.

OfficeFolders theme by Themocracy