HI friends for setWhatId i am unable to assign custom object record id. I am getting following exception. caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, Only contracts, cases, products and opportunities allowed for whatIds.: 
That means we can not use custom object records as merge fields ?. Its really bad from salesforce.