openSUSE Tumbleweed - server email forwarding

Created by: Administrator, Last modification: 22 August 2025

I have learnt quite a lot in the last couple of days when it comes to running email services from the command line. In the past I had simply looked at the raw 'root' email folder when a message popped up for 'new mail'. Now I have discovered mailx things are a lot easier and I can at least view things a message at a time via the ssh console. TODO a crib sheet of functions available in mailx and little things like -u user to view other mailboxes, but there should only be the root one hopefully.

postfix was always a black art, and I'm not sure I've mastered it yet! However I do have a much better understanding of where to find things.

The basic control commands and accessing the status does need to check the journal as some things don't appear in the status report

systemctl restart postfix
systemctl status postfix
journalctl -u postfix -r

In addition we need to follow a few bits when making changes to the configuration to ensure that the .lmdb version of the files are updated.

newaliases
postmap /etc/postfix/virtual

Crude check emails were useful while I was debugging things.

echo "Test email body" | mailx -s "Test Email" root
echo "Test email from sendmail" | sendmail -v suport@lsces.uk

But while all of this proved that email forwarding on both machines was working fine, while the development machine was sending emails from PHP, the production server was stubbornly silent. This was eventually tracked down to a missing 'execute' flag on the /etc/postfix directory since php tries to read the postfix main.cf file and running as 'nobody' it could not see it. I cleared up a lot of dross being posted in the php-fpm.log file before I actually spotted the error that pointed to main.cf although it took a little longer to spot that it was actually the directory setting that was the problem.

All of this does need expanding with a few more detailed crib sheets for areas such as the PHP settings and the options in postfix that can filter just what needs forwarding and what can be left locally. At the moment I'm getting 'undelivered mail' report for the daily cron job report despite the fact that the original HAS been delivered. I think though I'm getting two lots of traffic currently based on the log files, and I only need the one.