# ``twisted`.`mail`.`alias``

module documentation
(source)

Support for aliases(5) configuration files.

Author
Jp Calderone

Class | `AddressAlias` | An alias which translates one email address into another.
Class | `AliasBase` | The default base class for aliases.
Class | `AliasGroup` | An alias which points to multiple destination aliases.
Class | `FileAlias` | An alias which translates an address to a file.
Class | `FileWrapper` | A message receiver which delivers a message to a file.
Class | `MessageWrapper` | A message receiver which delivers a message to a child process.
Class | `MultiWrapper` | A message receiver which delivers a single message to multiple other message receivers.
Class | `ProcessAlias` | An alias which is handled by the execution of a program.
Class | `ProcessAliasProtocol` | A process protocol which errbacks a deferred when the associated process ends.
Class | `ProcessAliasTimeout` | An error indicating that a timeout occurred while waiting for a process to complete.
Function | `handle` | Parse a line from an aliases file.
Function | `loadAliasFile` | Load a file containing email aliases.

def handle(result, line, filename, lineNo): (source)
Parse a line from an aliases file.

Parameters
result:`dict` mapping `bytes` to `list` of `bytes` | A dictionary mapping username to aliases to which the results of parsing the line are added.
line:`bytes` | A line from an aliases file.
filename:`bytes` | The full or relative path to the aliases file.
lineNo:`int` | The position of the line within the aliases file.

def loadAliasFile(domains, filename=None, fp=None): (source)

Load a file containing email aliases.

Lines in the file should be formatted like so:

         username: alias1, alias2, ..., aliasN

Aliases beginning with a `|` will be treated as programs, will be run, and the message will be written to their stdin.

Aliases beginning with a `:` will be treated as a file containing additional aliases for the username.

Aliases beginning with a `/` will be treated as the full pathname to a file to which the message will be appended.

Aliases without a host part will be assumed to be addresses on localhost.

If a username is specified multiple times, the aliases for each are joined together as if they had all been on one line.

Lines beginning with a space or a tab are continuations of the previous line.

Lines beginning with a `#` are comments.

Parameters
domains:`dict` mapping `bytes` to `IDomain` provider | A mapping of domain name to domain object.
filename:`bytes` or `None` | The full or relative path to a file from which to load aliases. If omitted, the `fp` parameter must be specified.
fp:file-like object or `None` | The file from which to load aliases. If specified, the `filename` parameter is ignored.
Returns
`dict` mapping `bytes` to `AliasGroup` | A mapping from username to group of aliases.