Posted 2009-06-12 15:56 by Joe
How do I set up a catch-all email address to receive or bounce invalid inbound emails?
- Virtualmin
- Choose the domain name of your server from the pull-down menu
- Click "Edit Mail Aliases"
- Click "Add an alias to this domain"
- Set "Name" to "All mailboxes"
- Fill in the delivery settings as usual (a local mailbox, usually).
- Click "Bounce mail?" if you want to use this catch-all email account to bounce inbound emails with invalid email addresses.
To "turn off" the automatic email bouncing, simply delete this catch-all email alias.
What's the deal with @ in mailbox usernames?
It's a bad idea, according to Wietse Venema in this post on the Postfix mailing list: http://archives.neohapsis.com/archives/postfix/2000-02/0892.html
Virtualmin has several clever hacks to workaround this particular feature of Postfix, revolving around the creation of a second user with the same UID and paths, which Postfix can deliver to. This has many potential problems and might confuse other software that isn't smart enough to deal with multiple usernames with the same UID (this is perfectly legitimate, and ought to work, but it is a common failing and even some of our stuff has had some bugs uncovered, but now fixed, by this hack).
On recent operating systems (Fedora Core 5+, CentOS 5, Debian 4.0+, and Ubuntu 8.04LTS are all confirmed to have this issue) the Cyrus saslauthd version defaults to dropping the "@domain.tld" portion of the username before attempting authentication. This, obviously, won't work. The solution is to add the "-r" flag to the saslauthd command. On Red Hat based systems, additional flags can be added in the "FLAGS=" section of the file /etc/sysconfig/saslauthd. On Debian-based systems, the file to edit is /etc/default/saslauthd and the directive to modify is "PARAMS=". This is an orthogonal issue to the Postfix issues, and will occur whether you use Sendmail or Postfix as your mail server.
We don't recommend using @ in the username for mailbox users (for the same reasons that Wietse removed support for them in Postfix), but if you must it can be done. Any problems you run into should be brought up in the Bug Tracker, so we can get them resolved. Just because it's a hack doesn't mean we won't make it work as well as any othe naming convention.
Also note that this trick is incompatible with mbox style mail spools (because mail will be delivered to the "wrong" mailbox: user-domain.tld, instead of user@domain.tld). Maildir format mail spools are not subject to this problem, and are the default in Virtualmin if you have used our automated installation script.
If you really do want to use this type of username, edit the Server Template(s) for which you'd like this type of username. Browse to the "Mail for domain" section (select it in the dropdown, if using the Virtualmin theme, or scroll to this section if using any non-menu-ized theme). Find the option labeled "Format for usernames that include domain", and select "user@domain", and save your changes.
