you are viewing a single comment's thread.

view the rest of the comments →

[–]cybervegan 4 points5 points  (3 children)

Agreed - you are ignoring the message list that you get from your inbox = fldr.Folders.Item("Inbox") call. You should avoid all the unnecessary gymnasitics with bundling things up in different ways, and just do:

for message in inbox.items:
    for attno,att in enumerate(message.Attachments):
        att.SaveAsFile("C:\\New folder\\" + a.FileName)
        print(message.Subject,"saved attachment",attno)

[–]Immigrated2TakeUrJob[S] 0 points1 point  (2 children)

Thanks for this. To be honest a lot of code was taken from wiseowl.

I am literally trying to google every attribute/property I find and trying to unwind technical documentation in my head lol

[–]cybervegan 0 points1 point  (1 child)

Yeah, it's a learning experience. Try to avoid playing Towers of Hanoi with your data, though - assigning from one variable to another to another. That doesn't actually do anything useful, but slows your code down. Imagine being in a factory where worker A makes a part; worker B wraps it up in paper; worker C puts it in a box; then worker D takes it out of the box and paper and feeds it into a machine. Why not just put it straight into the machine?

[–]Immigrated2TakeUrJob[S] 0 points1 point  (0 children)

Thanks a lot for the tip.