Go to the latest version of this document.

# ``twisted`.`mail`.`maildir`.`AbstractMaildirDomain``

class documentation

`class AbstractMaildirDomain: (source)`

Known subclasses: `twisted.mail.maildir.MaildirDirdbmDomain`

Constructor: `AbstractMaildirDomain(service, root)`

Implements interfaces: `twisted.mail.interfaces.IAliasableDomain`

View In Hierarchy

An abstract maildir-backed domain.

Method | `__init__` | No summary
Method | `addUser` | Add a user to this domain.
Method | `exists` | Check whether a user exists in this domain or an alias of it.
Method | `getCredentialsCheckers` | Return credentials checkers for this domain.
Method | `requestAvatar` | Abstract domains cannot authenticate users.
Method | `setAliasGroup` | Set the group of defined aliases for this domain.
Method | `startMessage` | Create a maildir message for a user.
Method | `userDirectory` | Return the maildir directory for a user.
Method | `willRelay` | Check whether this domain will relay.
Instance Variable | `alias` | A mapping of username to alias.
Instance Variable | `root` | See `__init__`.

def __init__(self, service: `MailService`, root: `bytes`): (source)
overridden in `twisted.mail.maildir.MaildirDirdbmDomain`

Parameters
service:`MailService` | An email service.
root:`bytes` | The maildir root directory.

def addUser(self, user: `bytes`, password: `bytes`): (source)
from `twisted.mail.interfaces.IDomain`
overridden in `twisted.mail.maildir.MaildirDirdbmDomain`

Add a user to this domain.

Subclasses should override this method.

Parameters
user:`bytes` | A username.
password:`bytes` | A password.

def exists(self, user, memo=None): (source)
from `twisted.mail.interfaces.IAliasableDomain`

Check whether a user exists in this domain or an alias of it.

Parameters
user:`User` | A user.
memo:`None` or `dict` of `AliasBase` | A record of the addresses already considered while resolving aliases. The default value should be used by all external code.

Returns
no-argument callable which returns `IMessage` provider. | A function which takes no arguments and returns a message receiver for the user.

Raises
`SMTPBadRcpt` | When the given user does not exist in this domain or an alias of it.

def getCredentialsCheckers(self): (source)
from `twisted.mail.interfaces.IDomain`
overridden in `twisted.mail.maildir.MaildirDirdbmDomain`

Return credentials checkers for this domain.

Subclasses should override this method.

Returns
`list` of `ICredentialsChecker` provider | Credentials checkers for this domain.

def requestAvatar(self, avatarId: `bytes | tuple[]`, mind: `object`, *interfaces: `type[Interface]`) -> `tuple[type[Interface], object, Callable[[], None]]`: (source)
from `twisted.cred.portal.IRealm`
overridden in `twisted.mail.maildir.MaildirDirdbmDomain`

Abstract domains cannot authenticate users.

def setAliasGroup(self, alias): (source)
from `twisted.mail.interfaces.IAliasableDomain`

Set the group of defined aliases for this domain.

Parameters
alias:`dict` mapping `bytes` to `IAlias` provider. | A mapping of domain name to alias.

def startMessage(self, user): (source)

Create a maildir message for a user.

Parameters
user:`bytes` | A username.

Returns
`MaildirMessage` | A message receiver for this user.

def userDirectory(self, user): (source)
overridden in `twisted.mail.maildir.MaildirDirdbmDomain`

Return the maildir directory for a user.

Parameters
user:`bytes` | A username.

Returns
`bytes` or `None` | The user's mail directory for a valid user. Otherwise, `None`.

def willRelay(self, user, protocol): (source)

Check whether this domain will relay.

Parameters
user:`Address` | The destination address.
protocol:`SMTP` | The protocol over which the message to be relayed is being received.

Returns
`bool` | An indication of whether this domain will relay the message to the destination.

alias: `None | dict[bytes, AliasBase]` = (source)

A mapping of username to alias.

root = (source)

See `__init__`.