I want to send an Outlook email with multiple attachments from Python.
I referenced the following code Automate Outlook on Mac with Python
def add_attachment(self, p):
# p is a Path() obj, could also pass string
p = Alias(str(p)) # convert string/path obj to POSIX/mactypes path
attach = self.msg.make(new=k.attachment, with_properties={k.file: p})
When trying to add attachments, the same file is added multiple times instead of different files.
I tried passing the different attachments as a list and iterated over it to add each attachment.
def add_attachment(self, attachments):
# p is a Path() obj, could also pass string
# convert string/path obj to POSIX/mactypes path
for attachment in attachments:
p = Alias(str(attachment))
attach = self.msg.make(new=k.attachment, with_properties={k.file: p})