Question

I'm trying to open just a new Thunderbird email and attach a file to it for me to fill out the recipient email addresses' instead of hardcoding it. I'm using Windows 7, Python 2.7 and the latest version of Thunderbird.

I noticed some other questions like this but they all involved writing a Thunderbird plugin which isn't what I want to do. I know how to do this for Outlook like below and want to do the same thing:

    # 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()

Thanks

Was it helpful?

Solution

Thunderbird and other programs from Mozilla don't use win32com. Instead, they use xpcom. See [http://kb.mozillazine.org/Calling_Thunderbird_from_other_programs.

There is a python module, PyXPCOM, which could help you out with controlling Mozilla from Python, if you really want to.

You can also use AutoHotKey to script Thunderbird and many other programs, too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top