SMTP Delivery Provider

Deliver messages through a server using SMTP.

Using this provider, TurboMail can deliver your message using any standard SMTP server. Using an SMTP server is probably the most versatile choice for delivery, although there are several notable restrictions. SMTP servers often lie about accepting messages which may not deliver; specifically in the case where the recipient may not exist. SMTP is an asynchronous process whereby a message is handed off to an initial server which then passes the message along until it is finally delivered into a mailbox. Problems can occur anywhere along the chain of delivery, and usually these spawn delivery failure notification messages, addressed to the sender, which TurboMail is not currently capable of catching.

Installation

This provider is included in the base TurboMail installation.

Usage

Use this as your application-wide provider by setting the following configuration directive:

mail.provider = "smtp"

The SMTP Provider is capable of interpreting a number of error conditions, and raises exceptions as appropriate:

ProviderExhaustedException
Raised when attempting to deliver an expired message or when the SMTP server disconnects.
SMTPRecipientsRefused
Raised when the server refuses one or more of the desired message recipients.
SMTPSenderRefused
As per SMTPRecipientsRefused, except for the case of the sender address.

Other exceptions may be passed from the SMTP object during delivery. Messages which encounter errors will be logged and retried until expired.

Configuration

There are six configuration directives related to this plug-in:

mail.smtp.serverDefaults to "localhost".
Define the server to connect to with optional port number separated by a colon.
mail.smtp.userDefaults to None.
mail.smtp.passwordDefaults to None.
Define the username and password to authenticate with. Both a user name and password must be defined for authentication to be enabled.
mail.smtp.tlsDefaults to None.
If undefined (or None) TLS support will be automatically detected and enabled if present. To force TLS support to be enabled or disabled regardless, set to True or False respectively.
mail.smtp.debugDefaults to False.
Enable SMTP object debugging. This will echo to the console (not using the standard Python logging module) all communication between client and server.
mail.smtp.countDefaults to 10.
Set this to the maximum number of messages a single connection is willing to accept. If set too high, the SMTP Provider is capable of detecting an upset server and disconnecting automatically, though for performance and politeness reasons this value should be set correctly.