Outlook-Python-Tutorial icon indicating copy to clipboard operation
Outlook-Python-Tutorial copied to clipboard

NameError: name 'chunk' is not defined

Open bowsefather opened this issue 4 years ago • 0 comments

chunks = [distro[x:x+10] for x in range(0, len(distro), 10)] outlook = client.Dispatch('Outlook.Application') for chunks in chunks: for name, address in chunk: message = outlook.CreateItem(0) message.To = address message.Subject = "Asortie Furniture and Decoration" message.HTMLBody = template.format(name) message.Send() Sleep(120)

Traceback (most recent call last): File "<pyshell#17>", line 2, in for name, address in chunk: NameError: name 'chunk' is not defined

I'm an absolute noob when it comes to python, so i've been stuck trying to figure out how to fix the above error. I can save the emails in the drafts box, but whenever I want to distribute via chunking, I get this error. am I doing anything wrong?

bowsefather avatar Jun 23 '21 11:06 bowsefather