On Tue, 13 Feb 2024 at 16:52, Peter Humphrey <pe...@prh.myzen.co.uk> wrote: > For years, I've been using postfix to accept mail from LAN hosts, and from the > Internet via my ISP. This has never worked as I want it - it's just so complex > to set up and understand. Well, it is for a bear of little brain like me. > > Can someone tell me how to make postfix accept all mail addressed to any host > or user on the LAN - and not forward any mail to anywhere at all? It's running > on a single-homed host on the LAN, and all other hosts are also single homed. > Any of four hosts can originate mail, and I have fetchmail running on the same > host to collect POP3 mail from my ISP. Dovecot serves IMAP4 to KMail clients > on the LAN. > > At present, postfix is insisting on forwarding mail addressed to root on a LAN > machine, but it's supposed to be acting on behalf of that machine. Two other > hosts' mails never show up anywhere.
I'm not sure I quite understood where you're having problems, but I have a machine that accepts mail from the LAN through postfix, so I'll show some of my setup. Replace any <> with your hostnames. On the LAN machine I don't have postfix, I only send mail directly to the machine with 'sendmail', but I found that I have in /etc/mail/mailertable: 192.168. smtp:<mail machine hostname> <mail machine hostname> esmtp:<mail machine hostname> And in /etc/mail/local-host-names I have set <mail machine hostname> - maybe that does something, but I send mail directly with sendmail either way. On the postfix machine I have in /etc/postfix/aliases: root: arve This should make all mail to root be delivered to me. It also contains a bunch of aliases that I'm not sure if is necessary: arve@<hostname> arve arve@<hostname>.lan arve arve@<hostname>.localdomain arve arve@<other machine hostname>.lan arve In /etc/postfix/main.cf there is this, and I assume at least some of this makes this all work: myhostname = <hostname>.lan inet_interfaces = $myhostname, localhost mydestination = $myhostname, localhost.$mydomain, localhost, <hostname> mynetworks = 192.168.0.0/24, 127.0.0.0/8 Regards, Arve