Calling Thunderbird from other programs
From MozillaZine Knowledge Base
Thunderbird supports command line arguments to open the compose message window and fill in the headers, the message body and attachment(s), but you'd still have to press the send button.
Thunderbird doesn't have a scripting capability. Its functionality can be modifed using XUL based extensions. It does not support traditional plug-ins.
If all you want to do is to process new messages don't overlook writing a script that parses the "inbox." mbox file using the X-Mozilla-Status headers to figure out if a message is a new message. A mbox file is essentially just a flat text file that has a seperator between the messages and special encoding for any "From" strings if they occur at the beginning of a line in either the headers or the message body.