# ``twisted`.`mail`.`protocols`.`DomainDeliveryBase``

class documentation

`class DomainDeliveryBase: (source)`

Known subclasses: `twisted.mail.protocols.ESMTPDomainDelivery`, `twisted.mail.protocols.SMTPDomainDelivery`

Implements interfaces: `twisted.mail.interfaces.IMessageDelivery`

View In Hierarchy

A base class for message delivery using the domains of a mail service.

Method | `__init__` |
Method | `receivedHeader` | Generate a received header string for a message.
Method | `validateFrom` | Validate the address from which a message originates.
Method | `validateTo` | Validate the address for which a message is destined.
Instance Variable | `host` | See `__init__`
Instance Variable | `protocolName` | The protocol being used to deliver the mail. Sub-classes should set this appropriately.
Instance Variable | `service` | See `__init__`
Instance Variable | `user` | See `__init__`

def __init__(self, service, user, host=smtp.DNSNAME): (source)

Parameters
service:`MailService` | A mail service.
user:`bytes` or `None` | The authenticated SMTP user.
host:`bytes` | The hostname.

def receivedHeader(self, helo, origin, recipients): (source)
from `twisted.mail.interfaces.IMessageDelivery`
Generate a received header string for a message.

Parameters
helo:2-`tuple` of (`bytes`, `bytes`) | The client's identity as sent in the HELO command and its IP address.
origin:`Address` | The origination address of the message.
recipients:`list` of `User` | The destination addresses for the message.
Returns
`bytes` | A received header string.

def validateFrom(self, helo, origin): (source)
from `twisted.mail.interfaces.IMessageDelivery`
Validate the address from which a message originates.

Parameters
helo:2-`tuple` of (`bytes`, `bytes`) | The client's identity as sent in the HELO command and its IP address.
origin:`Address` | The origination address of the message.
Returns
`Address` | The origination address.
Raises
`SMTPBadSender` | When messages cannot be accepted from the origination address.

def validateTo(self, user): (source)
from `twisted.mail.interfaces.IMessageDelivery`
Validate the address for which a message is destined.

Parameters
user:`User` | The destination address.
Returns
`Deferred` which successfully fires with no-argument callable which returns `IMessage` provider. | A deferred which successfully fires with a no-argument callable which returns a message receiver for the destination.
Raises
`SMTPBadRcpt` | When messages cannot be accepted for the destination address.

host = (source)
See `__init__`
protocolName: `bytes` = (source)
overridden in `twisted.mail.protocols.ESMTPDomainDelivery`, `twisted.mail.protocols.SMTPDomainDelivery`
The protocol being used to deliver the mail. Sub-classes should set this appropriately.
service = (source)
See `__init__`
user = (source)
See `__init__`