Solved

Query size of Exchange 2003 email queue

Posted on 2013-01-06
11
307 Views
Last Modified: 2013-05-02
I am using various SQL stored procedures to generate emails through cdo. Emails are submitted to an Exchange 2003 server (on a different physical server on the LAN) where they sit in a SMTP queue until delivered (using DNS....no smart host).

I would like to find the oldest and newest date created for items in the queue and potentially the domains being delivered to, essentially providing similar information as is accessible via the Exchange System Manager queue snap-in.

How can I programmatically query the size of the mail queue, whilst fetching other metadata as above, using either ASP or a SQL function in order to display this in my ASP app?
0
Comment
Question by:drl1
  • 7
  • 4
11 Comments
 
LVL 42

Expert Comment

by:Eugene Z
ID: 38748826
0
 
LVL 42

Expert Comment

by:Eugene Z
ID: 38748829
btw: what is your sql version?
2005_+ has db mail queue tables
0
 

Author Comment

by:drl1
ID: 38748831
SQL Server 2008 on Windows Server 2008 R2
Exchange 2003 on Windows Server 2003
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

Author Comment

by:drl1
ID: 38748836
That link you provided is completely unrelated which makes me wonder if I was clear enough in my original request. I am *not* looking for a solution to items sitting in a mail queue, nor am I looking to send email through dbmail instead of CDO. I *am* looking for a way to programmatically query what is in the Exchange mail queue. The SQL Server and Exchange Server are not on the same physical server but *are* on the same LAN.
0
 
LVL 42

Expert Comment

by:Eugene Z
ID: 38748870
your original post is not so clear - but after your clarification (please rephrase your question from point of view what you need - and if you are using sql dbmail)

if you are using dbmail - please check
DB mail view that have all data about dbmail activities
http://msdn.microsoft.com/en-us/library/ms188023(v=sql.100).aspx
0
 
LVL 42

Expert Comment

by:Eugene Z
ID: 38748874
one more -- DBmail is SMTP based - and you need clarify if your Exchange server is SMNT server

for direct Exchange server mailbox stats info - you can use CDO\ADO\ etc..
DBmail logs\views  may give you what you need
0
 

Author Comment

by:drl1
ID: 38748887
SQL Server 2008 Stored Procedure generates mail through CDO and passes to Exchange 2003 SMTP on a separate physical box. No dbmail in use.

I wish to query the contents of the SMTP mail queue using ASP or T SQL executed on a system separate to the Exchange server.
0
 
LVL 42

Accepted Solution

by:
Eugene Z earned 500 total points
ID: 38749023
ok- so your home made sql procs using CDO
any plans to start using DBMail (it is better)
--
if you already have CDO base procs - use the CDO methods from above posted



see
http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Microsoft_IIS/Q_20960600.html

check
SmtpMail.Send(loMail)

http://bytes.com/topic/visual-basic-net/answers/377411-smtpmail-send-not-working-held-mailroot-queue-folder

check event viewer
SMTP errors

--
are your emails stuck ?
0
 
LVL 42

Expert Comment

by:Eugene Z
ID: 38749028
if your smtp mail got stuck in the queue folder-- check the folder
0
 
LVL 42

Expert Comment

by:Eugene Z
ID: 38749036
0
 

Author Comment

by:drl1
ID: 38749146
HUH? I'm not trying to solve a problem relating to emails being stuck and I'm not looking to switch to dbmail - that would be a completely different question, indeed the source of how the email is generated is completely irrelevant in this instance. I simply want to query what is in the Exchange SMTP queue and display the results as part of an application which is ASP/SQL driven. As the SQL instance is on a different box to the Exchange instance it's not possible to create a linked server using Exchange OLE DB Provider and so I need some other way of accessing this data. That is the only requirement here.

Let me make it a little easier....forget about SQL SP and CDO, how can I programmatically query the Exchange queue from a separate physical server using T SQL or ASP? That is all I am asking....
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help with a query 14 37
MS SQL Server Management Studio R2 4 30
Set arraylist as datatable 2 7
SQL profiler 3 12
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
The new Gmail Phishing Scam going around is surprising even the savviest of users with its sophisticated techniques.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question