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

class documentation

`class MessageWrapper: (source)`

Implements interfaces: `twisted.mail.interfaces.IMessageSMTP`

View In Hierarchy

A message receiver which delivers a message to a child process.

Method | `__init__` |
Method | `__str__` | Build a string representation of this `MessageWrapper` instance.
Method | `connectionLost` | Ignore notification of lost connection.
Method | `eomReceived` | Disconnect from the child process and set up a timeout to wait for it to exit.
Method | `lineReceived` | Write a received line to the child process.
Instance Variable | `completion` | The deferred which will be triggered by the protocol when the child process exits.
Instance Variable | `completionTimeout` | The number of seconds to wait for the child process to exit before reporting the delivery as a failure.
Instance Variable | `done` | A flag indicating whether the child process has exited (`True`) or not (`False`).
Instance Variable | `processName` | The process name.
Instance Variable | `protocol` | See `__init__`.
Instance Variable | `reactor` | A reactor which will be used to schedule timeouts.
Method | `_completionCancel` | Handle the expiration of the timeout for the child process to exit by terminating the child process forcefully and issuing a failure to the `completion` deferred.
Method | `_processEnded` | Record process termination and cancel the timeout call if it is active.
Instance Variable | `_timeoutCallID` | The call used to time out delivery, started when the connection to the child process is closed.

def __init__(self, protocol, process=None, reactor=None): (source)

Parameters
protocol:`ProcessAliasProtocol` | The protocol associated with the child process.
process:`bytes` or `None` | The process name.
reactor:`None` or `IReactorTime` provider | A reactor which will be used to schedule timeouts.

def __str__(self): (source)
Build a string representation of this `MessageWrapper` instance.

Returns
`bytes` | A string containing the name of the process.

def connectionLost(self): (source)
from `twisted.mail.interfaces.IMessageSMTP`
Ignore notification of lost connection.
def eomReceived(self): (source)
from `twisted.mail.interfaces.IMessageSMTP`
Disconnect from the child process and set up a timeout to wait for it to exit.

Returns
`Deferred` | A deferred which will be called back when the child process exits.

def lineReceived(self, line): (source)
from `twisted.mail.interfaces.IMessageSMTP`
Write a received line to the child process.

Parameters
line:`bytes` | A received line of the message.

completion: `Deferred` = (source)
The deferred which will be triggered by the protocol when the child process exits.
completionTimeout: `int` or `float` = (source)
The number of seconds to wait for the child process to exit before reporting the delivery as a failure.
done: `bool` = (source)
A flag indicating whether the child process has exited (`True`) or not (`False`).
processName: `bytes` or `None` = (source)
The process name.
protocol = (source)
See `__init__`.
reactor: `IReactorTime` provider = (source)
A reactor which will be used to schedule timeouts.
def _completionCancel(self): (source)
Handle the expiration of the timeout for the child process to exit by terminating the child process forcefully and issuing a failure to the `completion` deferred.
def _processEnded(self, result): (source)
Record process termination and cancel the timeout call if it is active.

Parameters
result:`Failure` | The reason the child process terminated.
Returns
`None` or `Failure` | None, if the process end is expected, or the reason the child process terminated, if the process end is unexpected.

_timeoutCallID: `None` or `IDelayedCall` provider = (source)
The call used to time out delivery, started when the connection to the child process is closed.