0

Consider the following scenario:

User 1:

From Address = "sender@domain.com"

To Address = "Receiver_1@domain.com"

Attachment = "common path --> file_1"

User 2:

From Address = "sender@domain.com"

To Address = "Receiver_2@domain.com"

Attachment = "common path --> file_2"

How do i execute the above task if it is to be carried out for 500 unique users, with 500 unique attachments (1 unique attachment per unique user)?

Thanks in advance!

Community
  • 1
  • 1

3 Answers3

0

You will need to loop over 500 recipients and send a separate message to each address.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Could you help me out with the code? i am not sure how to write one loop for recipients and another loop for the attachments.. – Deepankar Garg Dec 23 '19 at 22:57
0

Use mailmerge. It's a python programme to send individualized e-mails; you don't need outlook for that.

planetmaker
  • 5,884
  • 3
  • 28
  • 37
0

Python: Create Dictionary from Text/File that's in Dictionary Format

quick example-

import win32com.client

dictionary_list = {"Receiver_1@domain.com": r"C:\Temp\2019.pdf", "Receiver_2@domain.com": r"C:\Temp\2019.pdf", }
ol_app = win32com.client.Dispatch('Outlook.Application')

for key in dictionary_list:
    value = dictionary_list[key]
    email = ol_app.CreateItem(0)
    email.To = key
    email.Subject = "subject"
    email.HtmlBody = ""
    email.Attachments.Add(value)
    email.Display()
0m3r
  • 12,286
  • 15
  • 35
  • 71