Explanation and examples: simple programs to reading through emails with IMAP and responding with SMTP.
Reads inbox emails from a specified email account using IMAP and prints out the senders and subject lines.
Reads inbox emails from a specified email account using IMAP until a target string is found in the subject line. Then a response email is sent using SMTP to that same sender.
Scans inbox emails for target string in subject line using IMAP. Response with specified attachment using SMTP.
This information was the main source for building these programs.