.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Testing Database Mail Locally

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :Sql Server

I am in need of an SMTP server that is easy to configure, and that I can set up on my Windows 7 machine,  so that I can test the functionality of Database Mail. I haven't found anything very intuitive to use.

If you have any suggestions, please share.

Thank you for your help!


View Complete Post

More Related Resource Links

Unit Testing: Apply Test-Driven Development to your Database Projects


Jamie Laflen extols the benefits of TDD when applied to database development-and supplies some useful techniques along the way.

Jamie Laflen

MSDN Magazine Launch 2008

SQL and Outlook: Enable Database Access and Updates Through Exchange and Any E-mail Client


Using Microsoft technologies, you can insert, edit, query, and delete database entries using any e-mail client such as Hotmail, Outlook, Yahoo, or even WAP phone. While e-mail is certainly a powerful and widely used tool, it is usually not integrated with an application for performing any tasks other than sending reminders. The application scenario described here, an e-mail-based SQL update program, uses a simple data model; however, this solution will apply to any data model that you are working with. It will also eliminate the need for complex n-tier Internet applications and serves as a low maintenance solution for providing data access.

Alok Mehta and Daniel Williams

MSDN Magazine January 2002

Modify Subject line of Notification e-mails sent by Database Mail

Hello All, I am using database mail for SQL Server Agent Job notification.  It is working just great. However the e-mails that I receive have a specific format of subject line as below. SQL Server Job System: 'TEST' completed on \\Server_Name I wanted to see if I can modify this to send e-mails with this subject line. SQL Server Job System: 'TEST' completed on <Server_Name> Is this possible?  If so can someone help me with the steps? Thanks.

Database Mail configuring the maximum mail size (not attachment 'MaxFileSize')

Hi can anyone tell me if it's possible to configure the maximum size of an email when using database mail?  I know it's possible to use sysmail_configure_sp to set 'MaxFileSize', I want to prevent an email being sent the size of the body of the email is very large. In my case the body is based on a query result set inserted as html. Thanks      

Database Mail error

Hello I am new to SQL Server 2008. I am upgrading from 2000 to 2008 and currently working on Database Mail. I can send a test mail to say an email address like abc@xyz.com If i create an operator with the above email address, I am getting this error (in Database Mail log) when i send a test mail to Operator.  Message The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2010-09-07T10:31:24). Exception Message: Cannot send mails to mail server. (A recipient must be specified.). ) Any idea why Database Mail is able to send email when email address is specified and fails to send email to the same address when used in operator? Thank You, V

Mail data is truncated in Database mail

I have sent mail using Database mail...But I am getting only part of data in mail... The mail size remaining same. 8kb Is there is any limitation on mail size???Cheers...vaibhav

Database Mail Error Logs


I am New To Work With C#.I need To Retrieve The All Error Log In SQL Server.I Had Done All The Logs Except Database Mail Error Log. I need an An Help for How To Retrieving The Database Mail Error Log through C# Coding.



Getting Error in Database Mail in SQL 2008




I have configured Database Mail using sp_send_dbmail in SQL 2008. It was working fine but then it suddenly stops working


I tried to send a test e-mail from the Database Mail, and I got the following error message:


Getting below error:

Mail not queued. Database Mail is stopped. Use sysmail_start_sp to start Database Mail. (Microsoft SQL Server, Error: 14641)


Database Mail - How to clear queue list ?


Hi Experts,


i had a job on my client database which is running every 3 minutes to send out all my mail item list using Database Mail.

This job will automatically send out email which is retrieve from one of my table (DocumentQueue).

So whenever user click "Email" button on my system, system will add record on my table (DocumentQueue)

and every 3 minutes my job will started to send out all email in DocumentQueue which is not being send.


What my problem is... the recipient on my table in the wrong format, ie: admin@google.com;stone.wu@g;

And this email is being send on 09:00.

It keeps sending email every 3 minutes...

on the 1st 10 minutes the errors on sysmail_log was : 

"The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2010-10-04T09:28:00). Exception Message: Cannot send mails to mail server. (The specified string is not in the form required for an e-mail address.). )"

and after 10 minutes the errors was :

"The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2010-10-04T12:42:00). Exception Message: Could not connect to mail server. (An operation on a socket could not be performed because the system lack

Database Mail


Using SQL Server 2005 SP3 x64bit environment.   I configured Database Mail and can successfully send Test-Email.   However, when I create an Operator and configure a SQL Job to send a Notification to that Operator,  it never sends.

Any suggestions?

Database mail process does not start, no error generated, for only one maintenance plan

I have three maintenance plans:

1. Application DBs - 2am (checks integrity, full backup, log backup)
2. System DBs - 3am (checks integrity, updates statistics, full backup)
3. Backup and log file cleanup - 3:30am (removes backup history, .bak and .trn files)

For items 1 and 3 above, I see the database mail process start up and receive emails that the jobs completed.  For item 2, no email....the database mail process does not start and there are no errors in the event log.  The job history shows that the job completed successfully.

I'm having the same problem on a different server, except that items 2 and 3 email me their results, but item 1 does not.  Same exact job steps and times of execution.  None of the jobs are set to notify the operator, the notification is coming from the maintenance plan.

Obviously I've gone through the basics:

Configured an operator
Created a default, public profile
Enabled mail profile in SQL Server agent
Tested mail delivery

How do I diagnose the database mail process just not starting?  Has anyone seen this before?

SQL Server 2005 SP3, with KB 970892 applied.

SQL Agent Job Notification - Database Mail problem

I'm a little stumped. Have setup database mail on SQL Server 2008 (SP1 x64) and its working fine except when its supposed to send out a SQL Agent job notification.
I've enabled database mail on SQL Agent and have specified a profile, but when it tries to send an email on agent job completion it errors with "NOTE: Failed to notify '<operator>' via email."
Can anybody help?

Cannot open database on Locally Host


i have developed fees management system for school in asp.net , sql server 2005 as database , it was working fine before i host locally but when i host it locally it shows error on every dynamic page Error Server Error in '/fms' Application. Cannot open database "fees_system" requested by the login. The login failed. Login failed for user 'COMPUTER6\ASPNET'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Cannot open database "fees_system" requested by the login. The login failed. Login failed for user 'COMPUTER6\ASPNET'. Source Error: Line 17: cn = New SqlConnection Line 18: cn.ConnectionString = ConfigurationManager.ConnectionStrings("fees_systemConnectionString").ToString Line 19: cn.Open() Line 20: cmd = New SqlClient.SqlCommand("select * from login", cn) Line 21: dr = cmd.ExecuteReader Source File: F:\software\FeesManagementSystem\fees_system\homepage.aspx.vb Line: 19 Stack Trace: [SqlException (0x80131904): Cannot open database "fees_system" requested by the login. The login failed. Login failed for user 'COMPUTER6\ASPNET'.] System

SQL Server Agent Job And Database Mail - Error formatting query, probably invalid paramters


We have a stored procedure that we are trying to call with a SQL Server Agent Job. The stored procedure calls Database Mail. This is SQL 2008. The execute task is simply:


USE [Production]




When the job runs, it is erroring out immediately, with the error:

Execute as user: NT AUTHORITY\NETWORK SERVICE. Error formatting query, probably invalid paramters [SQLSTATE 42000] (Error 22050). The step failed.

When we go into SQL Server Manager and just execute the SQL query, it works though. Something within the SQL Server Agent job,  and Database Mail is causing problems. Any ideas? Thanks.



Messenger service is not in Windows 2008 but Sql Server 2008 is asking for it to run Database Mail


so how do you make Database Mail work in SQL Server 2008 without messenger service

Pat M


PatM Reno

Database mail configured, but mails not getting send?


I've configured Database mail, but mails are not getting sent. Checked BOL & various blogs and forums, I'm performing correct steps, using correct smtp server name & port.


DM mail log says: 

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 19 (2010-10-22T07:24:21). 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 <IP_ADD>:25).


On restarting SQL Agent, log says:

[355] The mail system failed to initialize; check configuration settings

[260] Unable to start mail session (reason: Microsoft.SqlServer.Management.SqlIMail.Server.Common.BaseException: Mail configuration information could not be read from the database. ---> System.Data.SqlClient.SqlException: profile name is not valid

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStre)


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend