slimta.policy.split

Implements a policy to break down envelopes with multiple recipients into logical groups. This is useful for relayers that may not handle multi-recipient messages well, such as MxSmtpRelay.

class slimta.policy.split.RecipientSplit([*args[, **kwargs]])

Bases: slimta.policy.QueuePolicy

If a given Envelope has more than one recipient, this policy splits it, generating a list of new Envelope object copies where each has only one recipient. Each new object has its own copy of headers, but other attributes may be shared between each new instance.

apply(envelope)

QueuePolicy sub-classes must override this method, which will be called by the Queue before storage.

Parameters:envelope – The Envelope object the policy execution should apply any changes to. This envelope object may be modified, though if new envelopes are returned this object is discarded.
Returns:Optionally return or generate an iterable of Envelope objects to replace the given envelope going forward. Returning None or an empty list will keep using envelope.
class slimta.policy.split.RecipientDomainSplit([*args[, **kwargs]])

Bases: slimta.policy.QueuePolicy

If a given Envelope recipients of more than one unique domain (case- insensitive), this policy splits it generating a list of new Envelope object copies where each has only one recipient. Each new object has its own copy of headers, but other attributes may be shared between each new instance.

Any recipient in the original Envelope that does not have a domain (and thus is not a valid email address) will be given an Envelope of its own.

apply(envelope)

QueuePolicy sub-classes must override this method, which will be called by the Queue before storage.

Parameters:envelope – The Envelope object the policy execution should apply any changes to. This envelope object may be modified, though if new envelopes are returned this object is discarded.
Returns:Optionally return or generate an iterable of Envelope objects to replace the given envelope going forward. Returning None or an empty list will keep using envelope.