Mail catchall/alias problem

Hello Everyone.

I installed Virtualmin GPL on a fresh Debain Lenny server using the install script and for the most part it is working very well.

I’m having a slight problem with the mail aliases however.
I have ten or so Virtual Hosts running and mail is being served to each of them fine. On one in particular I would like to have a catchall forwarder (I know it’s not the safest but I only want it so that I can find which of the addresses I have used in the past I wish to keep). Whenever I set a catchall to any address on this domain, mail for all the other domains starts being forwarded as well. Obviously this isn’t ideal as it means several users are wondering where their mail has gone.

I’ve tried deleting and re-adding the domain, deleting and re-adding the mailboxes and in my last move I removed every mailbox apart form the main domain mailbox but the same thing happened. I’ve also taken a look at /etc/postfix/virtual and /etc/postfix/main.conf but both seem to be in order.

The only thing I can think is that I set the domains to use username@domain before I read that this is a bad idea. Could this be casuing the bad behaviour? If not is there anything else I could try?

Cheers

Sam

In the Postfix servers general options in Webmin I noticed that I had specifically listed the problem domain in the box for ‘What domains to receive mail for’. I changed this setting to both ‘Local Machine’ and ‘Whole domain’ but nothing changed.
I also tried changing the hostname on my server as it was the domain name in question . I changed the hostname to mail.[domainname] but this also had no effect.

It’s no big thing as I can just add the email addresses which I know get used as individual forwarders (this works fine), I’m just curious as to why it’s happening

The only thing I can think is that I set the domains to use username@domain before I read that this is a bad idea. Could this be casuing the bad behaviour?

No; while there’s a slight amount of trickery that goes on in order to get things working when using username@domain, it really should work without issue when you do that. A lot of people use the username@domain format.

I also tried changing the hostname on my server as it was the domain name in question

Okay, I’m glad you brought this up, as I suspect this here is the issue :slight_smile:

I think going through and setting all the hostname related goodies to mail.domain.com will fix that up… to do that, you’ll need to edit 3 areas on your server –

  1. /etc/hosts, and change domain.com to mail.domain.com

  2. Edit /etc/postfix/main.cf, and change the “mydestination” line. Make sure “domain.com” isn’t on there at all – and you can just change that to mail.domain.com".

  3. You’ll also want to set the hostname itself, running “hostname mail.domain.com”.

Let us know if that does the trick!

-Eric

Thanks for the reply Eric. I changed the hostname to mail.domain using the hostname command and by editing /etc/hostname. I also added a mydestination line to /etc/postfix/main.conf which just referenced the new hostname. This gave me bounces to both the actual address and an address on a seperate domain that I have been using for testing.
The bounce message was “User unknown in virtual alias table”.

It looks like the mydestination variable in main.conf corresponds with the ‘What domains to receive mail for’ option in the Postfix general options page of webmin. I used the option here to try:
$myhostname, localhost.$mydomain, mail.domain - This bounced the message to the box itself but still forwarded the second domain to the first mailbox
and
$myhostname, localhost.$mydomain, $mydomain, mail.domain - This bounced both

In the end I have just set it to the webmin option of Whole Domain. This still forwards the second domains mail to the first mailbox so I will disable the catchall and just add addresses as single forwarders for the time being.