I am setting up database mail in SQL Server 2008to send mail to my Gmail account. The following is information about the profile DBMailthat I created:
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>
Then I clicked on and also made it the default public profile.
Then I use the following code TSQLto configure and submit 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"
However, my message becomes unsuccessful. I feel that the server is configured correctly. Any input would be appreciated.
SELECT * FROM sysmail_log
The body column displays
“Failed to send mail to recipients due to a failure of the mail server. (Sending mail using account 1 (2012-05-16T17: 05: 00). Exception message: failed to connect to the mail server. (No such host is known) .)