Solved

Query size of Exchange 2003 email queue

Posted on 2013-01-06
11
303 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:EugeneZ
ID: 38748826
0
 
LVL 42

Expert Comment

by:EugeneZ
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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:EugeneZ
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:EugeneZ
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:
EugeneZ 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:EugeneZ
ID: 38749028
if your smtp mail got stuck in the queue folder-- check the folder
0
 
LVL 42

Expert Comment

by:EugeneZ
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
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 video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now