?
Solved

Query size of Exchange 2003 email queue

Posted on 2013-01-06
11
Medium Priority
?
315 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 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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

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 1500 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

Independent Software Vendors: 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

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

839 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