PostFix is no longer using each individual domain name when sending and rejects recipient addresses

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.3
Webmin version 2.101

Postfix stopped working after I was messing with stuff and it now tries to send mail using the machine hostname instead of the domain for each virtual server as it once did. I also receive a “550 5.1.1 Recipient address rejected: User unknown in virtual alias table” when trying to send to a user.

Can you be more specific about what ‘stuff’?

It was quite a while ago. I uninstalled and reinstalled PostFix using command line and now it’s simply not working. It wasn’t letting me send over port 25 so I had it configured to 587 through mail jet. I think when my IP changed through my ISP, it messed with something.

Virtualmin > Re-check Configuration

Runs through that fine.

" The status of your system is being checked to ensure that all enabled features are available and properly configured …

Your system has 31.33 GiB of memory, which is at or above the Virtualmin recommended minimum of 256 MiB

Mail server Postfix is installed and configured

Postfix is configured to support per-domain outgoing IP addresses

Apache is installed

CGI scripts can be executed using suEXEC

Apache supports HTTP/2 on your system

The following PHP execution modes are available : cgi fcgid fpm

The following PHP versions are available : 8.1.2 (/bin/php-cgi8.1)

The following PHP-FPM versions are available : 8.1.2 (php8.1-fpm)

Webalizer is installed

Apache is configured to host SSL websites

MariaDB 10.6.12 is installed and running

ProFTPD is installed

Logrotate is installed

SpamAssassin and Procmail are installed and configured for use

ClamAV is installed and assumed to be running

Plugin AWStats reporting is installed

Plugin Protected web directories is installed

Using network interface eno1 for virtual IPs

Default IPv4 address for virtual servers is 10.0.0.69

Both user and group quotas are enabled for home and email directories

All commands needed to create and restore backups are installed

The selected package management and update systems are installed

Chroot jails are available

… your system is ready for use by Virtualmin"

I’m also seeing this when I run “Validate Virtual Servers”. For each domain it says

“Mail for domain : The mail server is not configured to receive email for <domain.com>”

I know dpkg will not configure the same which may have been what happened when you reinstalled.

Check your postfix for this line. This is how it looks when VM configures it:
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME

Sounds like you deleted your virtual map file or caused it to no longer be used.

Yes, that is in there.

I think this may be the case… Is there an easy way to recreate that?

I think you should have a virtual.db as well a virtual file, is that there?

Yes, I see both in /etc/postfix. virtual file is empty and I don’t know how to view virtual.db. I installed a DB Browser on another machine and downloaded the file but it said it cannot read it because its not a database file.

Thats not good. .db is built from the virtual file so it should be close to 0 bytes. Probably not a standard .db file. Do you have backups?

I do have backups but not from as long ago as it was working… I do have backups of all of my sites though so I theoretically could reinstall everything and restore domains from backups?

The virtual file is basically all you need hopefully. Not restore all files for at present. Also I would be worried the HDD may have corruption. Having a empty virtual file is very unusual.

Hmm okay. How would i recreate that file? I think it may have been removed/emptied when I was uninstalling stuff to initially troubleshoot a while ago.

I use vultr where I can create servers pretty quicky. Install virtualmin and restore virtualmin backups. From the server get the files you want. So you need a “development machine” you can grab the restore files from.

Okay I updated my virtual file to exactly what was created. It is still showing the same issues.

I ran these two commands and received no output (good thing I believe?).

$ sudo postmap /etc/postfix/virtual
$ sudo service postfix reload

I believe its all working now. I added a couple test users and they were automatically added to the virtual file. i went ahead and recreated users and it worked! thank you all for your help.

1 Like

Don’t make things worse!