{"id":262,"date":"2008-04-22T14:37:44","date_gmt":"2008-04-22T14:37:44","guid":{"rendered":"http:\/\/parkesy.wordpress.com\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/"},"modified":"2008-04-22T14:37:44","modified_gmt":"2008-04-22T14:37:44","slug":"clearing-exchange-2003-smtp-queues","status":"publish","type":"post","link":"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/","title":{"rendered":"Clearing Exchange 2003 SMTP Queues"},"content":{"rendered":"<p>Earlier this week we had a client whose junior sales person decided to do a mail shot to some of their customer base. He wanted to send some attachments with information. The attachments totaled about 5mb in size (the default outgoing size limit had been changed at their request some time ago)<\/p>\n<p>So the sales guy clicked the send button and the 5mb message was submitted to exchange to send out to 150 recipients<\/p>\n<p>See the problem here? The exchange server was busy trying to send over 750MB of email which was stopping everything else from going out<\/p>\n<p>When I logged onto the server and viewed the queues I was a bit that annoyed that I&#8217;d have to go into every queue (one per domain), click &#8220;find messages&#8221;, then &#8220;find&#8221;, then delete all the offending messages. I knew there must be a better way but decided to look into it later as the problem needed sorting. It took me about half an hour but I cleaned up and all was well<\/p>\n<p>Until the day after.<\/p>\n<p>The same guy did exactly the same thing but to over 200 recipients. After late time I&#8217;d suggested he uploaded the attachments to his website and had a link in the email but that advice fell on deaf ears<\/p>\n<p>So I had no wish to go through all the queues again<\/p>\n<p><a href=\"http:\/\/blog.netnerds.net\/2006\/04\/quick-code-delete-all-e-mails-from-the-exchange-queue\/\" target=\"_blank\" class=\"broken_link\">I found this post by Chrissy LeMaire<\/a> most helpful. She has a vbscript that you can use to completely wipe out ALL the messages in ALL queues.<\/p>\n<p>I didn&#8217;t want to be quite so destructive as there were legitimate messages still in the queue so I made some changes so that the script asks you who sent the message and only deletes the specific messages. It also has a &#8220;report&#8221; mode which is it a bit like a &#8220;are you really sure&#8221; message. This will just let you know how many message would have been deleted<\/p>\n<p>Here is the script. I&#8217;ve marked my changes so that the script can be returned to it&#8217;s original state<\/p>\n<p>On reflection my changes are a bit rough and ready and when I get some more time I may change the WMI query so that it returns just the messages I want instead of returning all the messages and then checking to see which ones to delete though that&#8217;s just me being picky I guess<\/p>\n<p>Also take a look at <a href=\"http:\/\/www.netnerds.net\" target=\"_blank\">Chrissy&#8217;s site<\/a>. It&#8217;s very useful and has been added to my feed list!<\/p>\n<p><code>'Original Author: Chrissy LeMaire<br \/>\n' Copyright 2003 NetNerds Consulting Group<br \/>\n' Script is provided AS IS with no warranties or guarantees and assumes no liabilities.<br \/>\n' Website: <a href=\"http:\/\/www.netnerds.net\">http:\/\/www.netnerds.net<\/a><br \/>\n' Description: This scripts empties out the entire Exchange queue. USE WITH CAUTION.<\/p>\n<p>' Modified by Andy Parkes - Changes indicated below<br \/>\n' www.andyparkes.co.uk<\/p>\n<p>' Andy's new section 1<br \/>\ndim txtemailAddress<br \/>\ndim mailcounter<br \/>\ndim deletemode<br \/>\nmailcounter = 0<br \/>\ndeletemode=\"NO\"<br \/>\ntxtemailAddress = LCASE(INPUTBOX(\"Please enter the email address SENDER to clear\"))<\/p>\n<p>if txtemailAddress = \"\" then<br \/>\nWScript.quit<br \/>\nend if<br \/>\ndeletemode=MSGBOX(\"Click YES for DELETE MODE or NO for REPORT MODE\",vbYesNo)<br \/>\n' End of new section 1<\/p>\n<p>Set objWMIExch = GetObject(\"winmgmts:\/\/.\/root\/MicrosoftExchangeV2\")<br \/>\nSet objLinksList = objWMIExch.ExecQuery (\"Select * from Exchange_SMTPLink\")<br \/>\nFor each objLinkInst in objLinksList<br \/>\nstrSQL = \"Select * from Exchange_SMTPQueue where \"<br \/>\nstrSQL = strSQL &amp; \"LinkID='\" &amp; objLinkInst.LinkID<br \/>\nstrSQL = strSQL &amp; \"' and LinkName='\" &amp; objLinkInst.LinkName<br \/>\nstrSQL = strSQL &amp; \"' and ProtocolName='\" &amp; objLinkInst.ProtocolName<br \/>\nstrSQL = strSQL &amp; \"' and VirtualMachine='\" &amp; objLinkInst.VirtualMachine<br \/>\nstrSQL = strSQL &amp; \"' and VirtualServerName='\" &amp; objLinkInst.VirtualServerName &amp; \"'\"<br \/>\nSet objQueuesList = objWMIExch.ExecQuery (strsql)<br \/>\nFor each objQueueInst in objQueuesList<br \/>\n        i = i +1<br \/>\n                If i &gt; 7 And InStr(objQueueInst.QueueName,\".\") &gt; 0 Then 'make sure its not the built in stuff<br \/>\n                    strSQL = \"Select * from Exchange_QueuedSMTPMessage where \" '&lt;-- This class requires that you pass ALL the variables below in the where  clause<br \/>\n                    strSQL = strSQL &amp; \"LinkID='\" &amp; objLinkInst.LinkID<br \/>\n                    strSQL = strSQL &amp; \"' and LinkName='\" &amp; objLinkInst.LinkName<br \/>\n                    strSQL = strSQL &amp; \"' and ProtocolName='\" &amp; objLinkInst.ProtocolName<br \/>\n                    strSQL = strSQL &amp; \"' and QueueID='\" &amp; objQueueInst.QueueID<br \/>\n                    strSQL = strSQL &amp; \"' and QueueName='\" &amp; objQueueInst.QueueName<br \/>\n                    strSQL = strSQL &amp; \"' and VirtualMachine='\" &amp; objLinkInst.VirtualMachine<br \/>\n                    strSQL = strSQL &amp; \"' and VirtualServerName='\" &amp; objLinkInst.VirtualServerName &amp; \"'\"<br \/>\n                    Set objQueuesList1 = objWMIExch.ExecQuery (strsql)<br \/>\n                       For each objQueueInst1 in objQueuesList1<br \/>\n                          If i &gt; 7 And InStr(objQueueInst1.QueueName,\".\") &gt; 0 Then<br \/>\n' Andy's new section 2<br \/>\n                                if LCASE(objQueueInst1.sender)=txtemailAddress then<br \/>\n                                     mailcounter = mailcounter + 1<br \/>\n                                     if deletemode=6 then<br \/>\n                                          objQueueInst1.DeleteNoNDR<br \/>\n                                     end if<br \/>\n                                 end if<br \/>\n' End of new section 2<br \/>\n                           End If<br \/>\n                         Next<br \/>\n                  End If<br \/>\n                  Next<br \/>\nNext<br \/>\n' Andy's new section 3<br \/>\nWScript.echo \"Operation completed - \" &amp; i &amp; \" queues scanned - \" &amp; mailcounter &amp; \" messages processed\"<br \/>\n' End of new section 3<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier this week we had a client whose junior sales person decided to do a mail shot to some of their customer base. He wanted to send some attachments with information. The attachments totaled about 5mb in size (the default outgoing size limit had been changed at their request some time ago) So the sales<\/p>\n<p><a class=\"readmore\" href=\"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/\"><span class=\"arrow-right icon\"><\/span>Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[13],"tags":[],"class_list":["post-262","post","type-post","status-publish","format-standard","hentry","category-exchange-2003"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.11 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Clearing Exchange 2003 SMTP Queues - Andy&#039;s Techie Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Clearing Exchange 2003 SMTP Queues - Andy&#039;s Techie Blog\" \/>\n<meta property=\"og:description\" content=\"Earlier this week we had a client whose junior sales person decided to do a mail shot to some of their customer base. He wanted to send some attachments with information. The attachments totaled about 5mb in size (the default outgoing size limit had been changed at their request some time ago) So the salesRead More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/\" \/>\n<meta property=\"og:site_name\" content=\"Andy&#039;s Techie Blog\" \/>\n<meta property=\"article:published_time\" content=\"2008-04-22T14:37:44+00:00\" \/>\n<meta name=\"author\" content=\"Andy Parkes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andy Parkes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/\",\"url\":\"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/\",\"name\":\"Clearing Exchange 2003 SMTP Queues - Andy&#039;s Techie Blog\",\"isPartOf\":{\"@id\":\"https:\/\/andyparkes.co.uk\/blog\/#website\"},\"datePublished\":\"2008-04-22T14:37:44+00:00\",\"dateModified\":\"2008-04-22T14:37:44+00:00\",\"author\":{\"@id\":\"https:\/\/andyparkes.co.uk\/blog\/#\/schema\/person\/3534e8ac6b1bec765cd061feff56679d\"},\"breadcrumb\":{\"@id\":\"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/andyparkes.co.uk\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Clearing Exchange 2003 SMTP Queues\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/andyparkes.co.uk\/blog\/#website\",\"url\":\"https:\/\/andyparkes.co.uk\/blog\/\",\"name\":\"Andy&#039;s Techie Blog\",\"description\":\"Professional Geek\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/andyparkes.co.uk\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/andyparkes.co.uk\/blog\/#\/schema\/person\/3534e8ac6b1bec765cd061feff56679d\",\"name\":\"Andy Parkes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/andyparkes.co.uk\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3824cbf53df51d7ca5cf809b6ad81a157fbfff2292e36ab8666f04ddad06bfcc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3824cbf53df51d7ca5cf809b6ad81a157fbfff2292e36ab8666f04ddad06bfcc?s=96&d=mm&r=g\",\"caption\":\"Andy Parkes\"},\"description\":\"Andy Parkes is Technical Director at Coventry based IT support company IBIT Solutions. Formerly, coordinator of AMITPRO and Microsoft Partner Area Lead for 2012-2013. He also isn't a fan of describing himself in the third person.\",\"sameAs\":[\"http:\/\/www.andyparkes.co.uk\/blog\"],\"url\":\"https:\/\/andyparkes.co.uk\/blog\/index.php\/author\/andyparkes\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Clearing Exchange 2003 SMTP Queues - Andy&#039;s Techie Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/","og_locale":"en_US","og_type":"article","og_title":"Clearing Exchange 2003 SMTP Queues - Andy&#039;s Techie Blog","og_description":"Earlier this week we had a client whose junior sales person decided to do a mail shot to some of their customer base. He wanted to send some attachments with information. The attachments totaled about 5mb in size (the default outgoing size limit had been changed at their request some time ago) So the salesRead More","og_url":"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/","og_site_name":"Andy&#039;s Techie Blog","article_published_time":"2008-04-22T14:37:44+00:00","author":"Andy Parkes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Andy Parkes","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/","url":"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/","name":"Clearing Exchange 2003 SMTP Queues - Andy&#039;s Techie Blog","isPartOf":{"@id":"https:\/\/andyparkes.co.uk\/blog\/#website"},"datePublished":"2008-04-22T14:37:44+00:00","dateModified":"2008-04-22T14:37:44+00:00","author":{"@id":"https:\/\/andyparkes.co.uk\/blog\/#\/schema\/person\/3534e8ac6b1bec765cd061feff56679d"},"breadcrumb":{"@id":"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/andyparkes.co.uk\/blog\/index.php\/2008\/04\/22\/clearing-exchange-2003-smtp-queues\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/andyparkes.co.uk\/blog\/"},{"@type":"ListItem","position":2,"name":"Clearing Exchange 2003 SMTP Queues"}]},{"@type":"WebSite","@id":"https:\/\/andyparkes.co.uk\/blog\/#website","url":"https:\/\/andyparkes.co.uk\/blog\/","name":"Andy&#039;s Techie Blog","description":"Professional Geek","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/andyparkes.co.uk\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/andyparkes.co.uk\/blog\/#\/schema\/person\/3534e8ac6b1bec765cd061feff56679d","name":"Andy Parkes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/andyparkes.co.uk\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3824cbf53df51d7ca5cf809b6ad81a157fbfff2292e36ab8666f04ddad06bfcc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3824cbf53df51d7ca5cf809b6ad81a157fbfff2292e36ab8666f04ddad06bfcc?s=96&d=mm&r=g","caption":"Andy Parkes"},"description":"Andy Parkes is Technical Director at Coventry based IT support company IBIT Solutions. Formerly, coordinator of AMITPRO and Microsoft Partner Area Lead for 2012-2013. He also isn't a fan of describing himself in the third person.","sameAs":["http:\/\/www.andyparkes.co.uk\/blog"],"url":"https:\/\/andyparkes.co.uk\/blog\/index.php\/author\/andyparkes\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pmvJ6-4e","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/andyparkes.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/andyparkes.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andyparkes.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andyparkes.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/andyparkes.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=262"}],"version-history":[{"count":0,"href":"https:\/\/andyparkes.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/262\/revisions"}],"wp:attachment":[{"href":"https:\/\/andyparkes.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andyparkes.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andyparkes.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}