Grant access to the profile to all msdb database users
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = ‘Default Public Profile’,
@principal_name = ‘public’,
@is_default = 1;
GO
Send a test email
EXECUTE msdb.dbo.sp_send_dbmail
@subject = ‘Test Database Mail Message’,
@recipients = ‘rafasg61@msn.com’, — enter your email address here
@query = ‘SELECT @@VERSION’; — gives you the version of SQL
GO