How to dynamically create a record in a custom module from an inbound email?

Hi All SugarCRM Experts,

I am able to create a case successfully on an inbound email for a
group account by enable Enable "Create Case from Email" in advance set
up, 

Instead of create a case, i want to create a record in custom module for this where can i write code? please guide me.
I am using CE 6.5.17

Naren..