Account verification using badmailto: Difference between revisions

From QmailToaster
Jump to navigation Jump to search
(Created page with "===Account verification using badmailto=== If you do not use a catchall account, then any incoming mail to an undefined account will be bounced or deleted, depending the CatchAll setting. However, if you choose to use a catchall account (for whatever reason), you can specify characteristics of invalid account names using entries in the badmailto control file to reject mail to invalid account names. For instance, if none of your account names contain the dash (-) ch...")
(No difference)

Revision as of 10:38, 16 March 2024

Account verification using badmailto

If you do not use a catchall account, then any incoming mail to an undefined account will be bounced or deleted, depending the CatchAll setting. However, if you choose to use a catchall account (for whatever reason), you can specify characteristics of invalid account names using entries in the badmailto control file to reject mail to invalid account names.

For instance, if none of your account names contain the dash (-) character, you can include the line

[-].*@mydomain\.com$

in your badmailto file. This will reject any account name containing a dash. In a similar fashion, if no account names contain a period (.), you could add that too:

[-.].*@mydomain\.com$

If none of the accounts in your domain contain numeric digits, you could add them as well:

[-.0-9].*@mydomain\.com$

Here's a brief explaination of what's going on in these examples:

  • [] specifies a class of characters. Any character contained within the braces is a member of the class.
  • the period (.) is a metacharacter meaning: any character.
  • the asterisk (*) is a metacharacter meaning: any number (0-n) of the preceding specification (class or character).
  • thus, .* means any number of any characters.
  • the regular expression will match a substring of the email recipient's address, so a leading .* is not necessary.
  • metacharacters lose their meaning (they're just normal characters) when included in a class specification.
  • if a dash (-) is included within a class specification ([]), it indicates a range of characters, unless it is the first character within the specification, when it is treated as a class member.
  • the last period (.) is escaped with a backslash (\) so it is treated as a period instead of its metacharacter value.
  • the dollar sign ($) is a metacharacter meaning: the end of the address line.

Regular expresssions in the badmailto file can be a powerful tool to reduce spam when using a catchall account.

For more information about regular expressions, Mastering Regular Expressions is an excellent resource.

User Tips & Tricks