Home arrow Python arrow Python Email Libraries: SMTP and Email Parsing

Python Email Libraries: SMTP and Email Parsing

The previous two articles in this series discussed connecting to the two major types of email servers and downloading messages. The task yet to be discussed is the actual sending of a message and how to represent an email message logically. In the first part of this article, we will discuss how to create the local data structure to represent an email message. The second part deals with actually connecting to an SMTP server and sending the message.

  1. Python Email Libraries: SMTP and Email Parsing
  2. The Python Email Library
  3. Manipulating Message Objects
  4. Sending Email Messages
By: Michael Swanson
Rating: starstarstarstarstar / 22
September 13, 2005

print this article



MIME Messaging

Python’s main library for dealing with email messages is called the email library, which contains many different objects. A good portion of these objects are concerned with creating and manipulating MIME objects. MIME stands for Multipurpose Internet Mail Extensions and is the standard for formatting email messages, especially email messages that carry attachments. A full discussion of MIME is quite extensive and beyond the scope of this article; however, some familiarity with the standard is useful for understanding how MIME messages are composed.

A MIME message is composed of many “parts,” each of which holds a separate piece of data. This data can be any number of different types, for example, it could be text, an image, a media file, or any number of other things. Most messages nowadays are classified overall as “multipart” which means they contain several different parts, each containing a different type of data. MIME defines several header fields to help with the task of classifying and separating the “parts” of an email message. 

Particularly, the Python libraries for email wrap much of the details surrounding the creation of MIME messages. This includes things like how to encode specific types of data so other email clients know how to decode the data, and creating message part boundary descriptions, which are often annoying low level tasks that the typical Python programmer doesn’t want to deal with directly.

>>> More Python Articles          >>> More By Michael Swanson

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates


Dev Shed Tutorial Topics: