Solved

Query size of Exchange 2003 email queue

Posted on 2013-01-06
11
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
11 Comments
 
LVL 43

Expert Comment

by:Eugene Z
ID: 38748826
0
 
LVL 43

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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

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 43

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 43

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 43

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 43

Expert Comment

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

740 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