How to send mail through SQL mail

1. Configure sql mail

Double click Database Mail in Management node in SSMS, set up new e-mail profile and specify its smtp account and relevancy

2. After configuration, execute script below.

use msdb
GO

exec sp_send_dbmail @profile_name='SQLAutherity',
@recipients='bocks@sqlauthority.com',
@subject='Test Message',
@body='This is the body of the test message. 
Congrates database mail received by you successfully.'

Attention, right click the Database Mail node, then select ‘View Database Mail Log’ to watch the status of process of DB mail, I got some error message coz of the connection rejected, Firewall, or 25 port blocked.

Message
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2013-02-20T11:30:28). Exception Message: Could not connect to mail server. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 220.181.15.112:25).
)
posted @ 2013-02-20 11:44  AOT  阅读(299)  评论(0编辑  收藏  举报