Module t.m.smtp

Part of twisted.mail View Source

Simple Mail Transfer Protocol implementation.
Line # Kind Name Docs
50 Interface IMessageDelivery No interface docstring; 3/3 methods documented
106 Interface IMessageDeliveryFactory An alternate interface to implement for handling message delivery.
122 Class SMTPError Undocumented
125 Class SMTPClientError Base class for SMTP client errors.
158 Class ESMTPClientError Base class for ESMTP client errors.
162 Class EHLORequiredError The server does not support EHLO.
169 Class AUTHRequiredError Authentication was required but the server does not support it.
176 Class TLSRequiredError Transport security was required but the server does not support it.
183 Class AUTHDeclinedError The server rejected our credentials.
193 Class AuthenticationError An error ocurred while authenticating.
203 Class TLSError An error occurred while negiotiating for transport security.
210 Class SMTPConnectError Failed to connect to the mail exchange host.
218 Class SMTPTimeoutError Failed to receive a response from the server in the expected time period.
226 Class SMTPProtocolError The server sent a mangled response.
234 Class SMTPDeliveryError Indicates that a delivery attempt has had an error.
238 Class SMTPServerError Undocumented
246 Class SMTPAddressError Undocumented
254 Class SMTPBadRcpt Undocumented
259 Class SMTPBadSender Undocumented
263 Function rfc822date Format an RFC-2822 compliant date string.
302 Function idGenerator Undocumented
308 Function messageid Return a globally unique random string in RFC 2822 Message-ID format
325 Function quoteaddr Turn an email address, possibly with realname part etc, into
343 Class AddressError Parse error in address
349 Class Address Parse and hold an RFC 2821 address.
449 Class User Hold information about and SMTP message recipient,
478 Interface IMessage Interface definition for messages that can be sent via SMTP.
497 Class SMTP SMTP server-side protocol.
962 Class SMTPFactory Factory for SMTP.
981 Class SMTPClient SMTP client for sending emails.
1202 Class ESMTPClient No class docstring; 1/18 methods documented
1396 Class ESMTP No class docstring; 3/12 methods documented
1567 Class SenderMixin Utility class for sending emails easily.
1618 Class SMTPSender Undocumented
1622 Class SMTPSenderFactory Utility factory for sending emails easily.
1695 Interface IClientAuthentication No interface docstring; 2/2 methods documented
1706 Class CramMD5ClientAuthenticator Undocumented
1720 Class LOGINAuthenticator Undocumented
1735 Class PLAINAuthenticator Undocumented
1751 Class ESMTPSender Undocumented
1789 Class ESMTPSenderFactory Utility factory for sending emails easily.
1819 Function sendmail Send an email
1869 Function sendEmail Send an email, optionally with attachments.
1964 Function xtext_encode Undocumented
1998 Function xtext_decode Decode the xtext-encoded string s using a fast extension function.
2004 Class xtextStreamReader Undocumented
2008 Class xtextStreamWriter Undocumented
2012 Function xtext_codec Undocumented
1975 Function _slowXTextDecode Decode the xtext-encoded string s.
def rfc822date(timeinfo=None, local=1): (source)
Format an RFC-2822 compliant date string.
Parameterstimeinfo(optional) A sequence as returned by time.localtime() or time.gmtime(). Default is now.
local(optional) Indicates if the supplied time is local or universal time, or if no time is given, whether now should be local or universal time. Default is local, as suggested (SHOULD) by rfc-2822.
ReturnsA string representing the time and date in RFC-2822 format.
def idGenerator(): (source)
Undocumented
def messageid(uniq=None, N=idGenerator().next): (source)

Return a globally unique random string in RFC 2822 Message-ID format

<datetime.pid.random@host.dom.ain>

Optional uniq string will be added to strenghten uniqueness if given.
def quoteaddr(addr): (source)
Turn an email address, possibly with realname part etc, into a form suitable for and SMTP envelope.
def sendmail(smtphost, from_addr, to_addrs, msg, senderDomainName=None, port=25): (source)

Send an email

This interface is intended to be a direct replacement for smtplib.SMTP.sendmail() (with the obvious change that you specify the smtphost as well). Also, ESMTP options are not accepted, as we don't do ESMTP yet. I reserve the right to implement the ESMTP options differently.
ParameterssmtphostThe host the message should be sent to
from_addrThe (envelope) address sending this mail.
to_addrsA list of addresses to send this mail to. A string will be treated as a list of one address
msgThe message, including headers, either as a file or a string. File-like objects need to support read() and close(). Lines must be delimited by '\n'. If you pass something that doesn't look like a file, we try to convert it to a string (so you should be able to pass an email.Message directly, but doing the conversion with email.Generator manually will give you more control over the process).
senderDomainNameName by which to identify. If None, try to pick something sane (but this depends on external configuration and may not succeed).
portRemote port to which to connect.
Returns

A Deferred, its callback will be called if a message is sent to ANY address, the errback if no message is sent.

The callback will be called with a tuple (numOk, addresses) where numOk is the number of successful recipient addresses and addresses is a list of tuples (address, code, resp) giving the response to the RCPT command for each address. (type: Deferred )
def sendEmail(smtphost, fromEmail, toEmail, content, headers=None, attachments=None, multipartbody='mixed'): (source)
Send an email, optionally with attachments.
Parameterssmtphosthostname of SMTP server to which to connect (type: str )
fromEmailemail address to indicate this email is from (type: str )
toEmailemail address to which to send this email (type: str )
contentThe body if this email. (type: str )
headersDictionary of headers to include in the email (type: dict )
attachmentsEach 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 )
multipartbodyThe 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 )
ReturnsThe returned Deferred has its callback or errback invoked when the mail is successfully sent or when an error occurs, respectively. (type: Deferred )
def xtext_encode(s, errors=None): (source)
Undocumented
def _slowXTextDecode(s, errors=None): (source)
Decode the xtext-encoded string s.
def xtext_decode(s, errors=None): (source)
Decode the xtext-encoded string s using a fast extension function.
def xtext_codec(name): (source)
Undocumented
API Documentation for Twisted, generated by pydoctor at 2008-10-26 16:12:37.