Wednesday, June 16, 2004

RSS Feed for Outgoing Mail

Further to my post yesterday with the IMF Blocked mail RSS feed script which I found quite useful I decided to create a feed for all outgoing email. To do this I used tracking ID 1020 which gets logged when mail is transferred to another server and then did a filter using a if statement to see if the mail is coming from the sending domain. The changes I made are as follows

Changed the Feed Title and Description

Set objField3 = objDom.createElement("title")
objfield3.text = "Outbound Mail Feed"

Set objField5 = objDom.createElement("description")
objfield5.text = "Outbound Mail Feed"

Changed the time scope of the script from 1 day to 2 hours by changing the following line

dtListFrom = DateAdd("h",-2,dtListFrom)

Changed the Query to look for 1020 message ID's

str = "Select * FROM Exchange_MessageTrackingEntry where entrytype = '1020' and OriginationTime > '" & strStartDateTime & "'"

Added the following if block inside the for next loop

For Each objEvent in colLoggedEvents
for i = 1 to objEvent.RecipientCount
if instr(objEvent.Senderaddress,"@mydomain.com.au") then .........

end if
next
Next

Then the last change was to create a new feed file to subscribe too.

objdom.save("\\mgnfs01\e$\inetpub\wwwroot\intranet\outbound.xml")

Then I scheduled it to run every hour because my news aggregator runs every hour the 2 hour period should be enough to pick up all new posts.

For small sites (especially those running SBS) this might be a good way to provide the owners with an easy way to veiw all mail thats being send out.