# ``twisted`.`mail`.`interfaces`.`IMessageDelivery``

interface documentation

`class IMessageDelivery(Interface): (source)`

Known implementations: `twisted.mail.protocols.DomainDeliveryBase`

View In Hierarchy

Undocumented

Method | `receivedHeader` | Generate the Received header for a message.
Method | `validateFrom` | Validate the address from which the message originates.
Method | `validateTo` | Validate the address for which the message is destined.

def receivedHeader(helo, origin, recipients): (source)
Generate the Received header for a message.

Parameters
helo:2-`tuple` of `bytes` and `bytes`. | The argument to the HELO command and the client's IP address.
origin:`Address` | The address the message is from
recipients:`list` of `User` | A list of the addresses for which this message is bound.
Returns
`bytes` | The full `"Received"` header string.

def validateFrom(helo, origin): (source)
Validate the address from which the message originates.

Parameters
helo:2-`tuple` of `bytes` and `bytes`. | The argument to the HELO command and the client's IP address.
origin:`Address` | The address the message is from
Returns
`Deferred` or `Address` | `origin` or a `Deferred` whose callback will be passed `origin`.
Raises
`SMTPBadSender` | Raised of messages from this address are not to be accepted.

def validateTo(user): (source)
Validate the address for which the message is destined.

Parameters
user:`User` | The address to validate.
Returns
no-argument callable | A `Deferred` which becomes, or a callable which takes no arguments and returns an object implementing `IMessageSMTP`. This will be called and the returned object used to deliver the message when it arrives.
Raises
`SMTPBadRcpt` | Raised if messages to the address are not to be accepted.