http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/
USE
msdb
GO
EXEC
sp_send_dbmail
@profile_name
=
'PinalProfile'
,
@recipients
=
'test@Example.com'
,
@subject
=
'Test message'
,
@body
=
'This is the body of the test message.
Congrates Database Mail Received By you Successfully.'
Database Mail keeps copies of outgoing e-mail messages and displays them in the sysmail_allitems,
sysmail_sentitems
, sysmail_unsentitems
, sysmail_faileditems
.
The status of the mail sent can be seen in sysmail_mailitems
table, when the mail is sent successfully the sent_status field of the
sysmail_mailitems table is set to 1 which can again be seen in
sysmail_sentitems table. The mails that are failed will have the
sent_status field value to 2 and those are unsent will have value 3.
The log can be checked in sysmail_log
table as shown below:
SELECT
*
FROM
sysmail_mailitems
GO
SELECT
*
FROM
sysmail_log
GO