<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bhutan Horizon &#187; Linux</title>
	<atom:link href="http://www.bhutanhorizon.com/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bhutanhorizon.com</link>
	<description>Welcome to Younten Jamtsho&#039;s Blog</description>
	<lastBuildDate>Thu, 10 Jun 2010 13:45:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Remove Mail Queue in Postfix</title>
		<link>http://www.bhutanhorizon.com/linux/remove-mail-queue-in-postfix.html</link>
		<comments>http://www.bhutanhorizon.com/linux/remove-mail-queue-in-postfix.html#comments</comments>
		<pubDate>Mon, 08 Feb 2010 09:43:56 +0000</pubDate>
		<dc:creator>younten</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.bhutanhorizon.com/?p=99</guid>
		<description><![CDATA[To see mail queue, enter: # mailq To remove all mail from the queue, enter: # postsuper -d ALL mail.pl [script removed the mail queue as entered after the script] #!/usr/bin/perl $REGEXP = shift &#124;&#124; die &#8220;no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!&#8221;; @data = qx; for (@data) { if (/^(\w+)(\*&#124;\!)?\s/) { $queue_id = $1; } [...]]]></description>
			<content:encoded><![CDATA[<p><strong>To see mail queue, enter</strong>:<br />
# mailq</p>
<p><strong>To remove all mail from the queue, enter</strong>:<br />
# postsuper -d ALL</p>
<p>mail.pl [script removed the mail queue as entered after the script]</p>
<blockquote><p>#!/usr/bin/perl</p>
<p>$REGEXP = shift || die &#8220;no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!&#8221;;</p>
<p>@data = qx</usr/sbin/postqueue -p>;<br />
for (@data) {<br />
  if (/^(\w+)(\*|\!)?\s/) {<br />
     $queue_id = $1;<br />
  }<br />
  if($queue_id) {<br />
    if (/$REGEXP/i) {<br />
      $Q{$queue_id} = 1;<br />
      $queue_id = &#8220;&#8221;;<br />
    }<br />
  }<br />
}</p>
<p>#open(POSTSUPER,&#8221;|cat&#8221;) || die &#8220;couldn&#8217;t open postsuper&#8221; ;<br />
open(POSTSUPER,&#8221;|postsuper -d -&#8221;) || die &#8220;couldn&#8217;t open postsuper&#8221; ;</p>
<p>foreach (keys %Q) {<br />
  print POSTSUPER &#8220;$_\n&#8221;;<br />
};<br />
close(POSTSUPER);</p></blockquote>
<p><strong>To run the script</strong><br />
./mail.pl xxx.com<br />
&#8216;or&#8217;<br />
./mail.pl info@xx.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bhutanhorizon.com/linux/remove-mail-queue-in-postfix.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
