Email from php

Is there any build in feature like beans i can use to send email in custom scripts. I owuld like to send email from a logic hoock script using a predefined template.

Any pointers to some documentation on this would be great.

I have found it, it is called SugarPHPMailer