Contents in Detail xix
Starting TLS Encryption ...................................... 364
Logging in to the SMTP Server ................................. 364
Sending an Email .......................................... 365
Disconnecting from the SMTP Server ............................. 366
IMAP ......................................................... 366
Retrieving and Deleting Emails with IMAP ................................ 366
Connecting to an IMAP Server ................................. 367
Logging in to the IMAP Server ................................. 368
Searching for Email......................................... 368
Fetching an Email and Marking It As Read......................... 372
Getting Email Addresses from a Raw Message ...................... 373
Getting the Body from a Raw Message ........................... 374
Deleting Emails ............................................ 375
Disconnecting from the IMAP Server ............................. 375
Project: Sending Member Dues Reminder Emails ........................... 376
Step 1: Open the Excel File ................................... 376
Step 2: Find All Unpaid Members ............................... 378
Step 3: Send Customized Email Reminders......................... 378
Sending Text Messages with Twilio .................................... 380
Signing Up for a Twilio Account ................................ 380
Sending Text Messages ...................................... 381
Project: “Just Text Me” Module........................................ 383
Summary ...................................................... 384
Practice Questions ................................................ 384
Practice Projects.................................................. 385
Random Chore Assignment Emailer.............................. 385
Umbrella Reminder ......................................... 385
Auto Unsubscriber.......................................... 385
Controlling Your Computer Through Email ......................... 386
17
MANIPULATING IMAGES 387
Computer Image Fundamentals ....................................... 388
Colors and RGBA Values ..................................... 388
Coordinates and Box Tuples................................... 389
Manipulating Images with Pillow ...................................... 390
Working with the Image Data Type .............................. 392
Cropping Images .......................................... 393
Copying and Pasting Images onto Other Images..................... 394
Resizing an Image.......................................... 397
Rotating and Flipping Images .................................. 398
Changing Individual Pixels .................................... 400
Project: Adding a Logo ............................................. 401
Step 1: Open the Logo Image.................................. 401
Step 2: Loop Over All Files and Open Images ...................... 402
Step 3: Resize the Images .................................... 403
Step 4: Add the Logo and Save the Changes ....................... 404
Ideas for Similar Programs .................................... 406
Drawing on Images ............................................... 406
Drawing Shapes ........................................... 406
Drawing Text ............................................. 408