Postfix configure is one of the most challenging thigs I know. Postfix is a very easy to configure application (on it's openSUSE default at least), but a very small change can stop all without notice in the logs. Testing is difficult as it needs sending a mail and waiting, sometime forever if the mail don't come nor come back with an error.
What I need and try to verify
What I need really is to be able to use my server as pop3, imap, smtp server. In current language, this mean I want to be able to fetch my mail from the server (so I need also to receive it on this server), removing it (pop3) or letting it on the server (imap), and send it to the world using the same server.
So at first I need to be able to write mail on the server itself, send it from a server account (for example root) to an other server account (for example jdd), then from jdd on the server to any mail outside (for example the mail I still have on my ISP's account).
I then need to be able to send mail from my local (home) desktop/laptop to the server, then using the server as relay send these mail to the whole Internet.
Sending and receiving locally
At this moment, I have only ssh access to the server, so I need a CLI (Command Line Interface) mail client. I use mailx (so mail jdd from root send a mail to the jdd account.
So, install postfix and mailx if it's not default. AFAIR, the local mailing works out of the box. Try it. The above command (mail jdd) asks for a subject, then a content. You send the mail typing Control D (hold control, type D) at the beginning of a line (so after hitting Enter).
Better open two xterm to the server, one as root, the other as user (jdd for me). Of course for this to work, you have to create first the recipient user :-).
As user, typing "mail" (without option) brings you in the mail reader and give a list of the incoming mails if any. Typing the mail number displays the mail.
Do NOT use YaST to configure Postfix (your mta), YaST try to fetch the mails from an external server.
Using more, configuring Postfix
The postfix config file is /etc/postfix/main.cf.
The default YaST (openSUSE) configuration is entirely at the end of the file, after all the comments. Here the last time an option is set win.
You can comment out most of the default options, only usefull in more complicated setups. My file holds only this:
mydomain = dodin.org myhostname = kim2.dodin.org myorigin = $mydomain mydestination = $mydomain,kim2.$mydomain, $myhostname
Later I add:
smtpd_recipient_restrictions = reject_rbl_client zen.spamhaus.org, permit smtpd_helo_required = yes
In hope the spam will be filtered
Where my domain is the domain name pointing to the server's IP, kim2 is the servers name itself, so myhostname parameter must have the FQDN (Full Qualified Domain Name) of your server.
mydestination must hold all the domain names accepted as mail recipient. The "kim2.$mydomain" is probably not necessary (as it's the same as myhostname), but was added at a moment and as it works, I don't bother removing it :-).
This is all what you need to send and receive mails from this computer... Think to open ports on the firewall for smtp. smtp is Simplifyed Mail Transport protocol and manage receiving and sending mails.
With this config, any server account is allowed to receive mails and to send them, but also to relay them to the world if coming from the world. That mean that jdd can use the server as relay to send mail to the world. This is "pop3/imap before smtp" authentification, that is you must have login to fetch mail before you can send.
This uses also clear text passwd sending, wich is not very secure, but most ISP uses only this, so may be the risk is not big. I may use one day secured accounts, but it's much more difficult to setup.
You can write an MX record on your DNS zone system, but it's not necessary if your server is the same that is listed as A record.
#ajouté par jdd, 23 Mai 2010 root: jdd, \root jean.daniel: jdd