I am using Database Mail functionality to send mail from a SQL Server 2008 database via following stored procedure execution:

EXEC sp_send_dbmail @profile_name = 'MyProfile', 
                    @recipients = '[email protected]', 
                    @subject = 'Test message',
                    @body = 'Congrats Database Mail Received By you Successfully.' 

I have tried with my gmail account profile on my local system it's working properly but not with my company or outlook profile.

Error message:

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 5 . 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 abc.j.i.ooo:pp). )



What would be the problem?


  • What error do you get? Have you spoken with your Exchange admins... by default, SMTP is locked down and the mailbox needs configured to work
    – gbn
    Commented Jun 6, 2013 at 6:57
  • I have added Error Message in my post please check thanks
    – Sukhjeevan
    Commented Jun 6, 2013 at 9:48
  • Is the mail system enabled and configured in the SQL Agent property pages?
    – Jon Seigel
    Commented Jun 6, 2013 at 13:07
  • @Sukhi try making the profile as public and then send a test email. Check with your exchange admin as well.
    – Kin Shah
    Commented Jun 11, 2013 at 19:48

3 Answers 3


I'm not sure what you are talking about with "gmail profile". SQL Server Database Mail has its own profiles and has nothing to do with any email clients on your machine.

When you create a Database Mail profile (SQL Server Management Studio, Management, Database Mail) you must specify the ip address of the SMTP server or servers to use. What you are confiruing is the "outgoing email server" for Database Mail (similar to configuring an Internet email client like Thunderbird or Windows Mail). Those SMTP servers must be configured to allow connection and to allow relaying from the SQL Server machine's ip address, something the email administrators will be able to do.

That error message suggests to me that either the above has not been configured or that there is a firewall between the SQL Server machine and the SMTP server that is blocking the traffic.

  • I got reference from an article which i have added in my question. so if i do the same through gmail account profile it's working properly but not with my company account profile ( i.e. [email protected])
    – Sukhjeevan
    Commented Jun 7, 2013 at 5:37
  • @Sukhi try making the profile as public and then send a test email. Check with your exchange admin as well.
    – Kin Shah
    Commented Jul 11, 2013 at 20:27

It looks like port 25 (or the port your mail server is using) is blocked, or perhaps the database server in question cannot contact the mail server in question at all, much less on a specific port.


If everything is configured properly in the sql mail side then: In my environment, the exchange admins had to enable my box for relay. After they enabled it i could send mails from sql on my local.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.