使用 Python 在 Mac 上自动化 Outlook 和发送电子邮件

问题描述 投票:0回答:0

我正在编写用于在 Mac 中自动执行 Outlook 电子邮件的 Python 脚本。

来自早期的 Stackoverflow 文章:使用 Python 在 Mac 上自动化 Outlook,代码可以显示带有附件的 Outlook 电子邮件,但我需要随后发送电子邮件。

我用

send_email
操作加了
Send()
,还是不行:

def create_message_with_attachment():
    subject = 'This is an important email!'
    body = 'Just kidding its not.'
    to_recip = ['[email protected]', '[email protected]']

    msg = Message(subject=subject, body=body, to_recip=to_recip)

    ...

    msg.send_email()

class Outlook(object):
    def __init__(self):
    self.client = app('Microsoft Outlook')

class Message(object):
    def __init__(self, parent=None, subject='', body='', to_recip=[], cc_recip=[], show_=True):

        if parent is None: parent = Outlook()
        client = parent.client

        self.msg = client.make(
            new=k.outgoing_message,
            with_properties={k.subject: subject, k.content: body})

        .....

    def send_email(self):
        self.msg.Send()

        ....

发送电子邮件的正确方法是什么?非常感谢!

python python-3.x macos email outlook
© www.soinside.com 2019 - 2024. All rights reserved.