<?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>Dusty Reagan &#187; POP3</title>
	<atom:link href="http://dustyreagan.com/tag/pop3/feed/" rel="self" type="application/rss+xml" />
	<link>http://dustyreagan.com</link>
	<description>On Technology &#38; Entrepreneurship</description>
	<lastBuildDate>Thu, 05 Apr 2012 06:25:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Tutorial on how to open and read an email using C# and POP3</title>
		<link>http://dustyreagan.com/tutorial-on-how-to-open-and-read-email/</link>
		<comments>http://dustyreagan.com/tutorial-on-how-to-open-and-read-email/#comments</comments>
		<pubDate>Sun, 07 May 2006 21:51:00 +0000</pubDate>
		<dc:creator>Dusty Reagan</dc:creator>
				<category><![CDATA[Web & Software Development]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[POP3]]></category>

		<guid isPermaLink="false">http://dev.dustyreagan.com/?p=17</guid>
		<description><![CDATA[For a recent project I found a great tutorial on how to read and manipulate emails using POP3 on Developer Fusion. Two things you should note when trying this code. 1) POP3 protocol won&#8217;t actually delete the email until you &#8230; <a href="http://dustyreagan.com/tutorial-on-how-to-open-and-read-email/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For a recent project I found a great tutorial on how to read and manipulate emails using POP3 on <a href="http://www.developerfusion.co.uk/show/4071/2/">Developer Fusion</a>.</p>
<p>Two things you should note when trying this code.</p>
<p>1) POP3 protocol won&#8217;t actually delete the email until you call the QUIT command. If your application fails before you call the Disconnect() method, no emails will be deleted.</p>
<p>2) I was unable to view the content of my emails without making a modification to the Response() method. Apparently the buffersize used in the tutorial was not sufficient for the emails I was viewing. The new method I used is posted on the <a href="http://www.developerfusion.co.uk/forums/thread/126636/2/">tutorial&#8217;s feedback forum</a> by &#8220;ddoctor.&#8221; It is as follows:</p>
<pre>private string Response()
{
   System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();

   long buffersize = 1024;
   byte[] serverbuff = new byte[buffersize];
   NetworkStream stream = GetStream();
   int count = 0;
   while (true)
   {
      byte[] buff = new byte[2];
      int bytes = stream.Read(buff, 0, 1 );
      if (bytes == 1)
      {
         // if serverbuffer is full, double its capacity
         if (count == buffersize)
         {
            byte[] temp = new byte[buffersize * 2];

            int i = 0;
            while (i &lt; buffersize)
            {
               temp = serverbuff;
               i++;
            }
            buffersize *= 2;
            serverbuff = temp;
         }

         serverbuff[count] = buff[0];
         count++;

         if (buff[0] == '\n')
         {
            break;
         }
      }
      else
      {
         break;
      };
   };
}</pre>
<img src="http://dustyreagan.com/?ak_action=api_record_view&id=17&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://dustyreagan.com/tutorial-on-how-to-open-and-read-email/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

