3

I am trying to setup database mail in ms sql 2005. I setup but everytime I try to send a msg through their email tester it fails and I get this msg.

Date 7/7/2010 10:54:12 AM Log Database Mail (Database Mail Log)

Log ID 48 Process ID 2148 Mail Item ID 23 Last Modified 7/7/2010 10:54:12 AM Last Modified By sa

Message The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2010-07-07T10:54:11). Exception Message: Cannot send mails to mail server. (Failure sending mail.). )

I don't understand why. I am using my isp smtp and it use to work for a brief time with database mail. I even pinged my smtp server through cmd prompt and I can reach it. So I don't understand why it does not work.

I even tried my hosting company smtp and gmail smtp. I always get the same msg.

When I try the tutorial provided my Km_ I get

1) Exception Information  ===================  Exception Type: System.NullReferenceException  Message: Object reference not set to an instance of an object.  Data: System.Collections.ListDictionaryInternal  TargetSite: Microsoft.SqlServer.Management.SqlIMail.Server.Objects.Account GetAccount(Int32)  HelpLink: NULL  Source: DatabaseMailEngine    StackTrace Information  ===================     at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.DataAccessAdapter.GetAccount(Int32 accountID)     at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.SessionManager.GetAccount(Int32 accountID)     at Microsoft.SqlServer.Management.SqlIMail.Server.Controller.CommandFactory.CreateSendMailCommand(DBSession dbSession)     at Microsoft.SqlServer.Management.SqlIMail.Server.Controller.CommandFactory.CreateCommand(DBSession dbSession)     at Microsoft.SqlServer.Management.SqlIMail.Server.Controller.CommandRunner.Run(DBSession db)     at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.ThreadCallBack.MailOperation(Object o)
chobo2
  • 461
  • 1
  • 10
  • 18

2 Answers2

1

Is database mail option ON? If not use this script and make sure it is on

sp_CONFIGURE 'show advanced', 1
GO
RECONFIGURE
GO
sp_CONFIGURE 'Database Mail XPs', 1
GO
RECONFIGURE
GO 
sp_CONFIGURE 'show advanced', 0
GO
RECONFIGURE
GO

Also make sure port 25 is open. If you are using gmail you may have to use port 587. check out this blog

DaniSQL
  • 1,107
  • 7
  • 12
0

There are many reasons this kind of thing can fail. Unfortunately, the log you got isn't detailed enough to trace the exact reason for it. What I'm suspecting is the case here is that the "From:" address in the mails is not configured correctly. Most mailers require either the To: or the From: address to be in a list of local domains ('gmail.com' for instance) and won't accept mail that doesn't have this. So if your mail is coming from "Administrator@database.local" and is sending to "someone@gmail.com" but forwarding through your local ISP's mailer, the ISP's mailer will reject the message. This kind of thing can be bypassed if you can configure authenticated-SMTP.

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
  • Well I am tried using like my 2 gmail accounts but using my local isp. So like from: first@gmail.com to second@gmail.com – chobo2 Jul 07 '10 at 19:11
  • I don't know if my local isp is rejecting my messages I now geto connection could be made because the target machine actively refused it IP of my isp provider. I don't get it though I tried different ports other than 25 and stil get that. – chobo2 Jul 07 '10 at 19:58
  • Some ISPs blacklist IP addresses that throw junk at it too often. You just might have crossed that threshold in all of your testing, thus the active refusal. At this point you'll have to wait until the blacklist goes away before you can try again. – sysadmin1138 Jul 07 '10 at 20:32
  • How long u figure that usually takes? I am also now trying my site hosting and have had a little bit of success where now I can send a database mail msg to my other accounts(from my hosting site) but if I try to send to my gmail one it dies. It says "Mailbox unavailable. The server response was: Authentication is required for relay" yet I am sure I have the right password. I copied it right from my web.config that I know works and sends email no any account no problem. – chobo2 Jul 07 '10 at 21:11
  • I don't know I changed my password to "12345" and copied and pasted my email address into the box and it still does not work. I can't win :( – chobo2 Jul 07 '10 at 21:17
  • The interval varies from 10 minutes to permanent. Unfortunately, there are several methods of authenticating SMTP logins, and only works if both halves of the conversation share one method. Also, TLS and SSL are both valid options for securing it but not all mailers support both. I love standards, there are so many to pick from. – sysadmin1138 Jul 07 '10 at 22:02