I need to send an e-mail from my custom php code using the Drupal service.
In other words, I've noticed Drupal can easily send emails so I would like to know how can I use drupal libraries to send the emails, instead of using external libraries.
You need to use drupal_mail(), and define hook_mail() in your module.
You'll then call the first one, and the e-mail information will be set by the second one.
(See the example on the documentation page for drupal_mail()
.)