Package twisted :: Package protocols :: Module smtp

[show private | hide private]
[frames | no frames]

## Module twisted.protocols.smtp

Simple Mail Transfer Protocol implementation.

Classes
`Address` | Parse and hold an RFC 2821 address.
`NDeferred` |
`SMTP` | SMTP server-side protocol.
`SMTPClient` | SMTP client for sending emails.
`SMTPFactory` | Factory for SMTP.
`SMTPSender` | Utility class for sending emails easily - use with SMTPSenderFactory.
`SMTPSenderFactory` | Utility factory for sending emails easily.
`User` | Hold information about and SMTP message recipient, including information on where the message came from

Exceptions
`AddressError` | Parse error in address
`SMTPError` |

Function Summary
Deferred | ``sendEmail`(smtphost, fromEmail, toEmail, content, headers, attachments, multipartbody)` Send an email, optionally with attachments.

Variable Summary
`str` | `atom`
`int` | `COMMAND`
`int` | `DATA`
`MetaInterface` | `IMessage`
`SelectReactor` | `reactor`
`tuple` | `StringTypes`

Function Details

### sendEmail(smtphost, fromEmail, toEmail, content, headers=None, attachments=None, multipartbody='mixed')

Send an email, optionally with attachments.

  Parameters:
    `smtphost` - hostname of SMTP server to which to connect
    (type=str)
    `fromEmail` - email address to indicate this email is from
    (type=str)
    `toEmail` - email address to which to send this email
    (type=str)
    `content` - The body if this email.
    (type=str)
    `headers` - Dictionary of headers to include in the email
    (type=dict)
    `attachments` - Each 3-tuple should consist of the name of the attachment, the mime-type of the attachment, and a string that is the attachment itself.
    (type=list of 3-tuples)
    `multipartbody` - The type of MIME multi-part body. Generally either "mixed" (as in text and images) or "alternative" (html email with a fallback to text/plain).
    (type=str)
  Returns:
    The returned Deferred has its callback or errback invoked when the mail is successfully sent or when an error occurs, respectively.
    (type=Deferred)

Variable Details

### atom

  Type:
    `str`
  Value:

        "[-A-Za-z0-9!\\#$%&'*+/=?^_`{|}~]"

### COMMAND

  Type:
    `int`
  Value:

        0

### DATA

  Type:
    `int`
  Value:

        1

### IMessage

  Type:
    `MetaInterface`
  Value:

        <class 'twisted.protocols.smtp.IMessage'>

### reactor

  Type:
    `SelectReactor`
  Value:

        <twisted.internet.default.SelectReactor instance at 0x82e8c8c>

### StringTypes

  Type:
    `tuple`
  Value:

        (<type 'str'>, <type 'unicode'>)

Generated by Epydoc 1.1 on Thu May 8 13:16:46 2003 | http://epydoc.sf.net