0

please help on below i want send multiple receptionist email from outlook

below is my code

import win32com.client`import csv`with open('D:/python changes report/keshav/people.txt', 'r') as file:`reader = csv.reader(file)
distro = [row for row in reader]
print(distro)
#for row in reader:
    #print(row)enter code here
chunks = [distro[x:+100] for x  in range (0, len(distro), 100)]
outlook = win32com.client.Dispatch('outlook.application')

for chunk in chunks:
    for email in chunk:
    message = outlook.CreateItem(0)
    message.TO = email
    message.Subject= "Test mail"
    message.Body = "if you received attachment then please reply"
    attachment1 = "D:/python changes report/keshav/output/DSR Tracker SMON.xlsx"
    attachment2 = "D:/python changes report/keshav/output/DSR Tracker REL.xlsx"
    message.Attachments.Add(attachment1)
    message.Attachments.Add(attachment2)
    message.Send()

but i got below error, please help to resolve

Traceback (most recent call last):

File "", line 4, in File "C:\Users\rupalim\AppData\Local\Programs\Python\Python39\lib\site-packages\win32com\client\dynamic.py", line 686, in setattr self.oleobj.Invoke(entry.dispid, 0, invoke_type, 0, value) pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', 'The object does not support this method.', None, 0, -2147352567), None)

0 Answers0