我正在SQL Server 2008
中设置数据库邮件,以发送邮件到我的Gmail帐户。以下是我创建的DBMail
配置文件的详细信息:
email id : xyz@gmail.com
Display Name : xyz
Reply email :
Server name : smtp.gmail.com
port no: 587
Check : This server requires a secure connection
Check : Basic Authentication
username : xyz@gmail.com ( should have gmail.com)
password : <mypassword>
confirm password : <mypassword>
然后我点击下一步并将其设置为默认公共配置文件。
然后我使用以下 TSQL
代码来配置和发送DBMail
:
EXEC sp_CONFIGURE 'show advanced', 1
GO
RECONFIGURE
GO
EXEC sp_CONFIGURE 'Database Mail XPs', 1
GO
RECONFIGURE
GO
use msdb
go
EXEC sp_send_dbmail
@profile_name='XYZ',
@recipients='XYZr@gmail.com',
@subject='Test message',
@body='Message Sent Successfully'
The output appears "Message Queued"
我的信息仍然发送失败。我感觉我已经正确地设置了服务器。如有任何建议,敬请赐教。
SELECT * FROM sysmail_log
Body一栏显示:
“邮件无法发送给收件人,因为邮件服务器故障。(使用账户1发送邮件(2012-05-16T17:05:00)。异常消息:无法连接到邮件服务器。(找不到此主机)。)”