【问题标题】:How to read inbox mails from Microsoft Outlook using python macOS?如何使用 python macOS 从 Microsoft Outlook 读取收件箱邮件?
【发布时间】:2021-01-18 07:36:33
【问题描述】:

我想验证我是否收到来自“发件人”的带有“主题”和特定“电子邮件”模板的电子邮件。我已经看到了适用于 windows 的 win32 模块的帮助链接。我想知道如何从 macOS 中读取我的 Microsoft Outlook 中的邮件。

【问题讨论】:

    标签: python outlook py-appscript


    【解决方案1】:

    我使用 appscript 库有类似的东西。您需要安装它。

    pip install appscript
    

    示例代码是这样的,您可能需要针对您的用例对其进行扩展。

    from appscript import app, k
    
    def make_msg(text):
        outlook = app('Microsoft Outlook')
    
        msg = outlook.make(
            new=k.outgoing_message,
            with_properties={
                k.subject: 'Test Email',
                k.plain_text_content: text})
    
        msg.make(
            new=k.recipient,
            with_properties={
                k.email_address: {
                    k.name: '<My name>',
                    k.address: '<My email ID>'}})
        msg.open()
        msg.activate()
    
    
    if __name__ == '__main__':
        make_msg("Sample text")
    

    如果您需要更多说明,请告诉我。

    【讨论】:

      猜你喜欢
      • 2014-05-20
      • 1970-01-01
      • 2018-10-27
      • 2020-05-30
      • 1970-01-01
      • 1970-01-01
      • 2011-10-14
      • 2012-03-24
      • 1970-01-01
      相关资源
      最近更新 更多