Forwarding an email with python smtplib
I'm trying to put together a script that automatically forwards certain emails that match a specific criteria to another email. I've got the downloading and parsing of messages using imaplib and email working, but I can't figure out how to forward an entire email to another address. Do I need to build a new message from scratch, or can I somehow modify the old one and re-send it? Here's what I have so far (client is an imaplib.IMAP4 connection, and id is a message ID): import smtplib, imaplib smtp = smtplib.SMTP(host, smtp_port) smtp.login(user, passw) client = imaplib.IMAP4(host) client.login