Solved

Query size of Exchange 2003 email queue

Posted on 2013-01-06
11
297 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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 extract information from SQL Server on Database, Connection and Server properties
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

708 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

19 Experts available now in Live!

Get 1:1 Help Now