Here’s an XCode template for creating a Mail.app plugin:
http://harnly.net/category/software/mail-plugin-template/
Some links and sample about how to write plugin for Mail.app:
*http://www.sente.ch/software/GPGMail/English.lproj/GPGMail.html#Download *http://www.cocoabuilder.com/archive/message/cocoa/2005/5/20/136461 *http://www.apple.com/downloads/macosx/email_chat/danielshttpmailplugin.html *http://www.tikouka.net/mailapp/ *http://eg-searchcgi.apple.com/cgi-bin/sp/nph-searchpre11.pl?q=plug+in+mail&client=osx_downloads_frontend&site=osx_downloads_email&oe=utf8&filter=0 *http://www.brunoblondeau.com/macresponder/ *http://www.bazza.com/~eaganj/weblog/2008/02/16/demystifying-mailapp-plugins-for-leopard/ *http://eaganj.free.fr/weblog/?post/2009/07/14/Demystifying-Mail.app-Plugins-on-Leopard