使用Python打开新的Thunderbird电子邮件

时间:2013-09-30 01:39:10

标签: python email python-2.7 thunderbird

我正在尝试打开一个新的Thunderbird电子邮件,并附上一个文件,以便我填写收件人的电子邮件地址,而不是硬编码。我正在使用Windows 7,Python 2.7和最新版本的Thunderbird。

我注意到其他一些问题,但他们都涉及编写Thunderbird插件,这不是我想要做的。我知道如何为Outlook做这个,如下所示,并希望做同样的事情:

    # open new e-mail in Outlook and attach the Map Package
    outlook = win32com.client.Dispatch("Outlook.Application")
    email = outlook.CreateItem(0)
    email.Subject = "Map Package Area of Interest"
    email.Attachments.Add(pkgPath)
    email.Display()

由于

1 个答案:

答案 0 :(得分:2)

Thunderbird和Mozilla的其他程序不使用win32com。相反,他们使用xpcom。见[http://kb.mozillazine.org/Calling_Thunderbird_from_other_programs

有一个python模块PyXPCOM,它可以帮助你从Python控制Mozilla,如果你真的想要。

您也可以使用AutoHotKey编写Thunderbird和许多其他程序的脚本。