Aliases and domain-side wildcards

A quick heads up, if you create an alias like postmaster@* = [email protected], MDaemon will follow that instruction literally, and alias postmaster@ every single domain whether or not you host it.

If one of your users were to try emailing [email protected] the mail would hit [email protected]

Instead of using postmaster@* you should use the $LOCALDOMAIN$ macro instead. Create an alias of postmaster@$LOCALDOMAIN$ = [email protected] to route the postmaster@ address for each of your domains, but no non-local domains, to your local administrator bob.

WorldClient and aliases

Did you know WorldClient has support for aliases?

Go create an alias (without wildcards), then hit the compose button in WorldClient and note that the FROM field is now a dropdown — You can choose to send mail using any alias which points to your mailbox.

Even better, when you reply to a message, WorldClient will automatically choose the alias to which the original message was addressed.

There is also a hidden INI switch that can influence this behavior,

WORLDCLIENT.INI, [Special] section.
UseFirstAlias=No (or Yes)

If this is set to yes, WorldClient will always use the first alias which applies to a mailbox (not counting wildcard aliases) rather then guessing at which alias is most appropriate.

Script to sort aliases

Some years ago I developed a script to sort aliases, placing wildcarded aliases at the bottom.  It was updated to support the new $LOCALDOMAIN$ format of wildcards.

Why would you want this?  Well, two reasons.  First, a sorted list makes it a lot easier to find what you’re looking for.  Second, if you add a non-wildcard alias below a wildcarded alias, the wildcarded alias may take effect first — If you’re manually adding aliases, you can hopefully remember to fix the order, but if you add aliases via a script, it’s important to get the sort order right.

I ran this on an hourly basis for several years, but please test this before deploying as I pulled it from some notes and not a live batch file.

@ECHO OFF
:MDSortAliases
C:
CD C:\MDaemon\App
FIND “$LOCALDOMAIN$” < ALIAS.DAT > ALIAS-WILD1.BAK
FIND “*” < ALIAS.DAT > ALIAS-WILD2.BAK
FIND “*” /v < ALIAS.DAT | FIND “$LOCALDOMAIN$” /v /i> ALIAS-NONW.BAK
SORT < ALIAS-NONW.BAK > ALIAS.DAT
SORT < ALIAS-WILD1.BAK >> ALIAS.DAT
SORT < ALIAS-WILD2.BAK >> ALIAS.DAT
DEL alias-wild1.bak
DEL alias-wild2.bak
DEL alias-nonw.bak
echo. > alias.sem

The above will sort aliases into three groups, non-wildcarded aliases, $LOCALDOMAIN$ aliases, then other wildcard aliases.  You can change the order by changing the names of the files in the SORT lines above.  Again, please backup and test first, I take no responsibility if your system bursts into flame after trying the above.

I make the potentially dangerous assumption that MDaemon is installed at C:\MDaemon\ — If not, please change the path.