top of page
grigoriyrozhkov372

SMTP supports both end-to-end and store-and-forward mail delivery methods[^2^]. It also works with m



The smtplib module defines an SMTP client session object that can be usedto send mail to any internet machine with an SMTP or ESMTP listener daemon. Fordetails of SMTP and ESMTP operation, consult RFC 821 (Simple Mail TransferProtocol) and RFC 1869 (SMTP Service Extensions).




smtp protocol pdf



Base class for all exceptions that include an SMTP error code. These exceptionsare generated in some instances when the SMTP server returns an error code. Theerror code is stored in the smtp_code attribute of the error, and thesmtp_error attribute is set to the error message.


Identify yourself to an ESMTP server using EHLO. The hostname argumentdefaults to the fully qualified domain name of the local host. Examine theresponse for ESMTP option and store them for use by has_extn().Also sets several informational attributes: the message returned bythe server is stored as the ehlo_resp attribute, does_esmtpis set to True or False depending on whether the server supportsESMTP, and esmtp_features will be a dictionary containing the namesof the SMTP service extensions this server supports, and their parameters(if any).


Each of the authentication methods supported by smtplib are tried inturn if they are advertised as supported by the server. See auth()for a list of supported authentication methods. initial_response_ok ispassed through to auth().


User code does not normally need to call auth directly, but can insteadcall the login() method, which will try each of the above mechanismsin turn, in the order listed. auth is exposed to facilitate theimplementation of authentication methods not (or not yet) supporteddirectly by smtplib.


The Simple Mail Transfer Protocol (SMTP) is an Internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages. User-level email clients typically use SMTP only for sending messages to a mail server for relaying, and typically submit outgoing email to the mail server on port 587 or 465 per .mw-parser-output cite.citationfont-style:inherit;word-wrap:break-word.mw-parser-output .citation qquotes:"\"""\"""'""'".mw-parser-output .citation:targetbackground-color:rgba(0,127,255,0.133).mw-parser-output .id-lock-free a,.mw-parser-output .citation .cs1-lock-free abackground:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat.mw-parser-output .id-lock-limited a,.mw-parser-output .id-lock-registration a,.mw-parser-output .citation .cs1-lock-limited a,.mw-parser-output .citation .cs1-lock-registration abackground:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat.mw-parser-output .id-lock-subscription a,.mw-parser-output .citation .cs1-lock-subscription abackground:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat.mw-parser-output .cs1-ws-icon abackground:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat.mw-parser-output .cs1-codecolor:inherit;background:inherit;border:none;padding:inherit.mw-parser-output .cs1-hidden-errordisplay:none;color:#d33.mw-parser-output .cs1-visible-errorcolor:#d33.mw-parser-output .cs1-maintdisplay:none;color:#3a3;margin-left:0.3em.mw-parser-output .cs1-formatfont-size:95%.mw-parser-output .cs1-kern-leftpadding-left:0.2em.mw-parser-output .cs1-kern-rightpadding-right:0.2em.mw-parser-output .citation .mw-selflinkfont-weight:inheritRFC 8314. For retrieving messages, IMAP (which replaced the older POP3) is standard, but proprietary servers also often implement proprietary protocols, e.g., Exchange ActiveSync.


SMTP's origins began in 1980, building on concepts implemented on the ARPANET since 1971. It has been updated, modified and extended multiple times. The protocol version in common use today has extensible structure with various extensions for authentication, encryption, binary data transfer, and internationalized email addresses. SMTP servers commonly use the Transmission Control Protocol on port number 25 (for plaintext) and 587 (for encrypted communications).


The original SMTP protocol supported only unauthenticated unencrypted 7-bit ASCII text communications, susceptible to trivial man-in-the-middle attack, spoofing, and spamming, and requiring any binary data to be encoded to readable text before transmission. Due to absence of a proper authentication mechanism, by design every SMTP server was an open mail relay. The Internet Mail Consortium (IMC) reported that 55% of mail servers were open relays in 1998,[14] but less than 1% in 2002.[15] Because of spam concerns most email providers blocklist open relays,[16] making original SMTP essentially impractical for general use on the Internet.


As this protocol started out purely ASCII text-based, it did not deal well with binary files, or characters in many non-English languages. Standards such as Multipurpose Internet Mail Extensions (MIME) were developed to encode binary files for transfer through SMTP. Mail transfer agents (MTAs) developed after Sendmail also tended to be implemented 8-bit clean, so that the alternate "just send eight" strategy could be used to transmit arbitrary text data (in any 8-bit ASCII-like character encoding) via SMTP. Mojibake was still a problem due to differing character set mappings between vendors, although the email addresses themselves still allowed only ASCII. 8-bit-clean MTAs today tend to support the 8BITMIME extension, permitting some binary files to be transmitted almost as easily as plain text (limits on line length and permitted octet values still apply, so that MIME encoding is needed for most non-text data and some text formats). In 2012, the SMTPUTF8 extension was created to support UTF-8 text, allowing international content and addresses in non-Latin scripts like Cyrillic or Chinese.


Message transfer can occur in a single connection between two MTAs, or in a series of hops through intermediary systems. A receiving SMTP server may be the ultimate destination, an intermediate "relay" (that is, it stores and forwards the message) or a "gateway" (that is, it may forward the message using some protocol other than SMTP). Per RFC 5321 section 2.1, each hop is a formal handoff of responsibility for the message, whereby the receiving server must either deliver the message or properly report the failure to do so.


Once the final hop accepts the incoming message, it hands it to a mail delivery agent (MDA) for local delivery. An MDA saves messages in the relevant mailbox format. As with sending, this reception can be done using one or multiple computers, but in the diagram above the MDA is depicted as one box near the mail exchanger box. An MDA may deliver messages directly to storage, or forward them over a network using SMTP or other protocol such as Local Mail Transfer Protocol (LMTP), a derivative of SMTP designed for this purpose.


Once delivered to the local mail server, the mail is stored for batch retrieval by authenticated mail clients (MUAs). Mail is retrieved by end-user applications, called email clients, using Internet Message Access Protocol (IMAP), a protocol that both facilitates access to mail and manages stored mail, or the Post Office Protocol (POP) which typically uses the traditional mbox mail file format or a proprietary system such as Microsoft Exchange/Outlook or Lotus Notes/Domino. Webmail clients may use either method, but the retrieval protocol is often not a formal standard.


SMTP is a connection-oriented, text-based protocol in which a mail sender communicates with a mail receiver by issuing command strings and supplying necessary data over a reliable ordered data stream channel, typically a Transmission Control Protocol (TCP) connection. An SMTP session consists of commands originated by an SMTP client (the initiating agent, sender, or transmitter) and corresponding responses from the SMTP server (the listening agent, or receiver) so that the session is opened, and session parameters are exchanged. A session may include zero or more SMTP transactions. An SMTP transaction consists of three command/reply sequences:


SMTP is a delivery protocol only. In normal use, mail is "pushed" to a destination mail server (or next-hop mail server) as it arrives. Mail is routed based on the destination server, not the individual user(s) to which it is addressed. Other protocols, such as the Post Office Protocol (POP) and the Internet Message Access Protocol (IMAP) are specifically designed for use by individual users retrieving messages and managing mail boxes. To permit an intermittently-connected mail server to pull messages from a remote server on demand, SMTP has a feature to initiate mail queue processing on a remote server (see Remote Message Queue Starting below). POP and IMAP are unsuitable protocols for relaying mail by intermittently-connected machines; they are designed to operate after final delivery, when information critical to the correct operation of mail relay (the "mail envelope") has been removed.


After the message sender (SMTP client) establishes a reliable communications channel to the message receiver (SMTP server), the session is opened with a greeting by the server, usually containing its fully qualified domain name (FQDN), in this case smtp.example.com. The client initiates its dialog by responding with a HELO command identifying itself in the command's parameter with its FQDN (or an address literal if none is available).[21]


STARTTLS is effective only against passive observation attacks, since the STARTTLS negotiation happens in plain text and an active attacker can trivially remove STARTTLS commands. This type of man-in-the-middle attack is sometimes referred to as STRIPTLS, where the encryption negotiation information sent from one end never reaches the other. In this scenario both parties take the invalid or unexpected responses as indication that the other does not properly support STARTTLS, defaulting to traditional plain-text mail transfer.[41] Note that STARTTLS is also defined for IMAP and POP3 in other RFCs, but these protocols serve different purposes: SMTP is used for communication between message transfer agents, while IMAP and POP3 are for end clients and message transfer agents. 2ff7e9595c


0 views0 comments

Recent Posts

See All

3D Live

O que é 3D Live e por que você deve se importar Introdução Você já desejou poder ver seu filme, jogo ou programa favorito de uma maneira...

Comments


bottom of page