Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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 = 'abc@companyname.com', 
                    @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). )

Reference

http://blogs.msdn.com/b/suhde/archive/2009/07/12/how-to-configure-sql-server-database-mail-to-send-email-using-your-windows-live-mail-account-or-your-gmail-account.aspx

What would be the problem?

Thanks

share|improve this question

migrated from stackoverflow.com Jun 6 '13 at 9:40

This question came from our site for professional and enthusiast programmers.

    
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 Jun 6 '13 at 6:57
    
I have added Error Message in my post please check thanks –  Sukhi Jun 6 '13 at 9:48
    
Is the mail system enabled and configured in the SQL Agent property pages? –  Jon Seigel Jun 6 '13 at 13:07
    
@Sukhi try making the profile as public and then send a test email. Check with your exchange admin as well. –  Kin Jun 11 '13 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.

share|improve this answer
    
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. abc@companyname.com) –  Sukhi Jun 7 '13 at 5:37
    
@Sukhi try making the profile as public and then send a test email. Check with your exchange admin as well. –  Kin Jul 11 '13 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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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