Link to home
Start Free TrialLog in
Avatar of drl1
drl1Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Query size of Exchange 2003 email queue

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?
Avatar of EugeneZ
EugeneZ
Flag of United States of America image

btw: what is your sql version?
2005_+ has db mail queue tables
Avatar of drl1

ASKER

SQL Server 2008 on Windows Server 2008 R2
Exchange 2003 on Windows Server 2003
Avatar of drl1

ASKER

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.
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
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
Avatar of drl1

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of EugeneZ
EugeneZ
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if your smtp mail got stuck in the queue folder-- check the folder
Avatar of drl1

ASKER

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