There are several ways to send e-mail. One of the ways would be to use one of the existing e-mail modules.
This is one of the most commonly used e-mail modules:
E-mail module with templates
It also includes documentation – be sure to follow it when implementing this module.