I need to send a lot of emails to many different recipients with many attachments. I'd like to be able to review the emails and add any additional attachments that may need to be added prior to sending. Currently this code will only open one window (email), requiring that one to be sent or closed before showing another. How can I get all of the emails open and visible at the same time?
def mailer(text, subject, recipient, attachments):
import win32com.client as win32
list(attachments)
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = recipient
mail.Subject = subject
mail.HtmlBody = text
for each in attachments:
mail.Attachments.Add(Source=each)
mail.Display(True)
mailer("", " TEST 1", test_address, "")
mailer("", " TEST 2", test_address, "")
mailer("", " TEST 3", test_address, "")
mailer("", " TEST 4", test_address, "")