After setting up an email account / profile in SQL server (https://robbamforth.wordpress.com/2008/10/21/sql-server-2005-database-mail/) you must give each user account permission to access the sp_send_dbmail procedure.
This is done in the following way:
When setting up a new user, select the User Mapping option from the left hand side of the screen.
Scroll down to the MSDB database and tick the box next to it.
Under Database role Membership for:MSDB select DatabaseMailUserRole.
Complete the new user set up as usual.
This user now has permission to access procedures using the sp_send_dbmail command, such as sending database mail:
@profile_name = EMAIL_PROFILE’,
@recipients = firstname.lastname@example.org’,
@subject = ‘This is a test email’,
@body = ‘Sample Message’,
@body_format = ‘HTML’;