Problem with using Databasemail with SQL Server 2005

Hello,
I want to use databasemail to send automatic reports.
So I run Databasemail Configuration Wizar, after few minutes everything was complete.
Then I send test mail from SQL Server 2005, nothing happens.

From computer where is installed SQL Server 2005 i can telnet to smtp without any problems. Everything seems to be ok.

On developing server where is installed SQL Server 2008R2 i configure exactly same parameters like on SQL Server 2005. On develop server databasemail works fine.


In the end i lookup for errors in EventViewer and i found 2 errors:

FIRST

Event Type:      Error
Event Source:      DatabaseMail
Event Category:      None
Event ID:      0
Date:            2012-04-06
Time:            14:18:03
User:            N/A
Computer:      HADRON
Description:


1) Exception Information
===================
Exception Type: System.TypeInitializationException
TypeName: System.Data.SqlClient.SqlConnection
Message: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void .ctor(System.String)
HelpLink: NULL
Source: System.Data

StackTrace Information
===================
   at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
   at Microsoft.SqlServer.Management.Common.SqlConnectionInfo.CreateConnectionObject()
   at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.ConnectionManager.OpenConnection(SqlConnectionInfo ci)
   at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.DataAccessAdapter.OpenConnection(String dbServerName, String dbName, String userName, String password)
   at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.QueueItemProcesser.ProcessQueueItems(String dbName, String dbServerName, Int32 lifetimeMinimumSec, LogLevel loggingLevel)

2) Exception Information
===================
Exception Type: System.TypeInitializationException
TypeName: System.Data.SqlClient.SqlConnectionFactory
Message: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void .cctor()
HelpLink: NULL
Source: System.Data

StackTrace Information
===================
   at System.Data.SqlClient.SqlConnection..cctor()

3) Exception Information
===================
Exception Type: System.TypeInitializationException
TypeName: System.Data.SqlClient.SqlPerformanceCounters
Message: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void .ctor()
HelpLink: NULL
Source: System.Data

StackTrace Information
===================
   at System.Data.SqlClient.SqlConnectionFactory..ctor()
   at System.Data.SqlClient.SqlConnectionFactory..cctor()

4) Exception Information
===================
Exception Type: System.Configuration.ConfigurationErrorsException
Message: Configuration system failed to initialize
BareMessage: Configuration system failed to initialize
Filename: NULL
Line: 0
Errors: System.Configuration.ConfigurationException[]
Data: System.Collections.ListDictionaryInternal
TargetSite: Void EnsureInit(System.String)
HelpLink: NULL
Source: System.Configuration

StackTrace Information
===================
   at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
   at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
   at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
   at System.Configuration.ConfigurationManager.GetSection(String sectionName)
   at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
   at System.Diagnostics.DiagnosticsConfiguration.Initialize()
   at System.Diagnostics.Switch.InitializeConfigSettings()
   at System.Diagnostics.Switch.InitializeWithStatus()
   at System.Diagnostics.Switch.get_SwitchSetting()
   at System.Data.ProviderBase.DbConnectionPoolCounters..ctor(String categoryName, String categoryHelp)
   at System.Data.SqlClient.SqlPerformanceCounters..ctor()
   at System.Data.SqlClient.SqlPerformanceCounters..cctor()

5) Exception Information
===================
Exception Type: System.Configuration.ConfigurationErrorsException
Message: Unrecognized configuration section system.serviceModel. (C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config line 134)
BareMessage: Unrecognized configuration section system.serviceModel.
Filename: C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config
Line: 134
Errors: System.Configuration.ConfigurationException[]
Data: System.Collections.ListDictionaryInternal
TargetSite: Void ThrowIfErrors(Boolean)
HelpLink: NULL
Source: System.Configuration

StackTrace Information
===================
   at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
   at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
   at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


SECOND

Event Type:      Error
Event Source:      .NET Runtime 2.0 Error Reporting
Event Category:      None
Event ID:      5000
Date:            2012-04-06
Time:            14:18:04
User:            N/A
Computer:      HADRON
Description:
EventType clr20r3, P1 databasemail90.exe, P2 9.0.242.0, P3 4d0276ad, P4 system, P5 2.0.0.0, P6 4ea7901b, P7 5a2, P8 7, P9 system.typeinitialization, P10 NIL.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 63 00 6c 00 72 00 32 00   c.l.r.2.
0008: 30 00 72 00 33 00 2c 00   0.r.3.,.
0010: 20 00 64 00 61 00 74 00    .d.a.t.
0018: 61 00 62 00 61 00 73 00   a.b.a.s.
0020: 65 00 6d 00 61 00 69 00   e.m.a.i.
0028: 6c 00 39 00 30 00 2e 00   l.9.0...
0030: 65 00 78 00 65 00 2c 00   e.x.e.,.
0038: 20 00 39 00 2e 00 30 00    .9...0.
0040: 2e 00 32 00 34 00 32 00   ..2.4.2.
0048: 2e 00 30 00 2c 00 20 00   ..0.,. .
0050: 34 00 64 00 30 00 32 00   4.d.0.2.
0058: 37 00 36 00 61 00 64 00   7.6.a.d.
0060: 2c 00 20 00 73 00 79 00   ,. .s.y.
0068: 73 00 74 00 65 00 6d 00   s.t.e.m.
0070: 2c 00 20 00 32 00 2e 00   ,. .2...
0078: 30 00 2e 00 30 00 2e 00   0...0...
0080: 30 00 2c 00 20 00 34 00   0.,. .4.
0088: 65 00 61 00 37 00 39 00   e.a.7.9.
0090: 30 00 31 00 62 00 2c 00   0.1.b.,.
0098: 20 00 35 00 61 00 32 00    .5.a.2.
00a0: 2c 00 20 00 37 00 2c 00   ,. .7.,.
00a8: 20 00 73 00 79 00 73 00    .s.y.s.
00b0: 74 00 65 00 6d 00 2e 00   t.e.m...
00b8: 74 00 79 00 70 00 65 00   t.y.p.e.
00c0: 69 00 6e 00 69 00 74 00   i.n.i.t.
00c8: 69 00 61 00 6c 00 69 00   i.a.l.i.
00d0: 7a 00 61 00 74 00 69 00   z.a.t.i.
00d8: 6f 00 6e 00 20 00 4e 00   o.n. .N.
00e0: 49 00 4c 00 0d 00 0a 00   I.L.....

When i run manually databasemail90.exe, then in the EventViewer came out same errors.

Configuration:
Windows Server 2003 x64 with updates
SQL Server 2005 x64 with updates


How handle this problem ?

Thanks in advance.
jpospAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AnuroopsunddCommented:
can you kill the databasemail executable on the server and then try again.
0
jpospAuthor Commented:
@Anuroopsundd - yesterday i restarted server, so i think this is equal to re-run databasemail executable;

EDIT:
i checkout windows process and there was no databasemail process
0
AnuroopsunddCommented:
Yes, restart do the stuff.
by any chance can you reinstall the latest Service pack for sql ?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

jpospAuthor Commented:
0
AnuroopsunddCommented:
That's right..
0
jpospAuthor Commented:
@Anuroopsundd - i try to reinstall SP4, but i can't update database services beacause it is up-to-date
0
AnuroopsunddCommented:
To use this wizard you must be a member of the sysadmin fixed server role. To send Database Mail you must be a member of the DatabaseMailUserRole database role in the msdb database.

Note:  
Enabling SQL Server Service Broker in any database requires a database lock. If Service Broker was deactivated in msdb, to enable Database Mail, first stop SQL Server Agent so Service Broker can obtain the necessary lock.

http://msdn.microsoft.com/en-us/library/ms175951(v=sql.90).aspx
0
jpospAuthor Commented:
I configure database mail like in sqlserverclub.com, i don't think is problem with config.

I troubleshoot with:
http://msdn.microsoft.com/en-us/library/ms187540(v=sql.90).aspx
and seems to be ok, except the fact, that mail are still in queue.
0
AnuroopsunddCommented:
so you are seeing the mail in outlook queue.?
0
AnuroopsunddCommented:
were you able to test account setting in outlook?
0
jpospAuthor Commented:
I'm back :)

So i didn't install Outlook on server. But I test that account setting in Outlook and in development SQL Server 2008R2 and it works fine.
0
jpospAuthor Commented:
In SQL Server Agent Log i found this:


[260] Unable to start mail session (reason: System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.Confi)



SQL Surface Area Configuration - exception when chosen Features
And this is my machine.config serviceModel section:


<system.serviceModel>
    <extensions>
      <behaviorExtensions>
        <add name="persistenceProvider" type="System.ServiceModel.Configuration.PersistenceProviderElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="workflowRuntime" type="System.ServiceModel.Configuration.WorkflowRuntimeElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="enableWebScript" type="System.ServiceModel.Configuration.WebScriptEnablingElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="webHttp" type="System.ServiceModel.Configuration.WebHttpElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </behaviorExtensions>
      <bindingElementExtensions>
        <add name="webMessageEncoding" type="System.ServiceModel.Configuration.WebMessageEncodingElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="context" type="System.ServiceModel.Configuration.ContextBindingElementExtensionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </bindingElementExtensions>
      <bindingExtensions>
        <add name="wsHttpContextBinding" type="System.ServiceModel.Configuration.WSHttpContextBindingCollectionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="netTcpContextBinding" type="System.ServiceModel.Configuration.NetTcpContextBindingCollectionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="webHttpBinding" type="System.ServiceModel.Configuration.WebHttpBindingCollectionElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="basicHttpContextBinding" type="System.ServiceModel.Configuration.BasicHttpContextBindingCollectionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </bindingExtensions>
    </extensions>
    <client>
      <metadata>
        <policyImporters>
          <extension type="System.ServiceModel.Channels.ContextBindingElementImporter, system.workflowservices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
        </policyImporters>
        <wsdlImporters>
          <extension type="System.ServiceModel.Channels.ContextBindingElementImporter, system.workflowservices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
        </wsdlImporters>
      </metadata>
    </client>
  </system.serviceModel>
0
jpospAuthor Commented:
I'm resolved problem.
I've used http://blogs.msdn.com/b/joy/archive/2008/07/22/how-to-use-microsoft-net-framework-cleanup-utility.aspx and then reinstall .NET Framework 2.0, now everything works :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jpospAuthor Commented:
There was a problem with machine.config, probably it was corrupted, after reinstall .net framework works ok
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.