changing email configuration

Dear experts,

I have trouble to send email using mail() to my email server but I can user Pear Mail::factory without problem.  I'm thinking about incoperating Pear Mail to the elgg source code but the thing is I don't know how. 

Could anyone point out which part of the code that can be modified so that this version of elgg is using Pear Mail instead of using mail().

Regards,

ethereal1m