I need to send a certain email to a lot of different addresses, one recipient at a time. It has an attachment.
So far, I've programmed this as such :
1) create a Thread object per mail-address (looping through the recipients list).
2) within each Thread object, create the MIMEMultipart() message.
3) within each Thread object, send the mail through smtplib.SMTP("smtp.gmail.com:587")
It's working fine.
The problem with this approach is that the attachment has to be attached separately for every single email. Is there a way to only attach it once ? A global MIMEMultipart() message is not possible because different threads would have to change it (to change the recipient's address).