Part 1 of this article explain step by step, how to configure Database Mail in SQL Server 2008.
Functions in SQL Server: Practical Guide