473,395 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

email reader fail

I am trying to create an email reader in vb.net 2008 but when I use the following code I get an error message saying
"Unable to read data from the transport connection: An established connection was aborted by the software in your host machine."

Expand|Select|Wrap|Line Numbers
  1.  
  2. Imports System.Net.Sockets
  3. Imports System.Text
  4. Public Class Home
  5.  
  6.     Private Sub GetMailButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetMailButton.Click
  7.         Dim tcpClient As New TcpClient()
  8.         tcpClient.Connect("pop.gmail.com", Convert.ToInt32("995"))
  9.  
  10.         Dim netStream As NetworkStream = tcpClient.GetStream()
  11.         Dim strReader As New System.IO.StreamReader(netStream)
  12.  
  13.         RichTextBox1.Text = strReader.ReadLine() & "<br />"
  14.  
  15.         Dim WriteBuffer(1023) As Byte
  16.         Dim enc As ASCIIEncoding = New System.Text.ASCIIEncoding()
  17.  
  18.         WriteBuffer = enc.GetBytes("USER " & "testemail.email5" & Constants.vbCrLf)
  19.         netStream.Write(WriteBuffer, 0, WriteBuffer.Length)
  20.         RichTextBox1.Text += strReader.ReadLine() & "<br />"
  21.  
  22.         WriteBuffer = enc.GetBytes("PASS " & "testpassword" & Constants.vbCrLf)
  23.         netStream.Write(WriteBuffer, 0, WriteBuffer.Length)
  24.         RichTextBox1.Text += strReader.ReadLine() & "<br />"
  25.  
  26.         WriteBuffer = enc.GetBytes("LIST" & Constants.vbCrLf)
  27.         netStream.Write(WriteBuffer, 0, WriteBuffer.Length)
  28.  
  29.         Dim ListMessage As String
  30.         Do
  31.             ListMessage = strReader.ReadLine()
  32.             If ListMessage = "." Then
  33.                 Exit Do
  34.             Else
  35.                 RichTextBox1.Text += ListMessage & "<br />"
  36.                 Continue Do
  37.             End If
  38.         Loop
  39.  
  40.         WriteBuffer = enc.GetBytes("QUIT" & Constants.vbCrLf)
  41.         netStream.Write(WriteBuffer, 0, WriteBuffer.Length)
  42.         RichTextBox1.Text += strReader.ReadLine() & "<br />"
  43.     End Sub
  44. End Class
  45.  
Oct 31 '11 #1
0 1022

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: Dynamo | last post by:
Hi The following script was taken from John Coggeshall's (PHP consultant) in his article on Zends site at http://www.zend.com/zend/spotlight/ev12apr.php // Get the email address to validate...
3
by: jeef | last post by:
Im emailing using Jmail and i'd like to send an html encoded email. The form is setup and it emails out but when i receive it the comes back as the html code. what do i need to do so that it...
6
by: | last post by:
I am rewriting a C++ application in C#. This file has a combination of Text and Binary data. I used CFile before to read the text. If I hit a certain string that denotes the following data is...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
2
by: AGGoogle | last post by:
I might be doing something stupid here but I really need some help. Can someone please tell me why can't I get this xml to pass my validation when I use XmlValidatingReader? The XMLSpy seems to...
2
by: Li-fan Chen | last post by:
Hi, We find ourselves in the unenviable position of creating an email reader, may I ask how we best parse incoming messages? Ideally we would point the parser at a email stored in a POP3--grab...
3
by: Raghu | last post by:
I have following schema: <?xml version="1.0" encoding="utf-8"?> <xs:schema elementFormDefault="qualified" targetNamespace="http://mycompany.services.customer2/types/restricted"...
1
by: Frank | last post by:
Hello All, I am exploring and developing a plan for a C# web app or windows app to handle bounced emails. Basically, I need to develop a system where I weed out bad addresses in our db...but...
3
by: Shelly | last post by:
When using the mail() call, I formatted the message with "\n" for new lines. The text of the email ran together without line breaks. I also tried "\r\n" and that also didn't work. The email...
3
by: popoandtheeggman | last post by:
Can someone make a program that will check an email account, upload an email, and scroll the text or email subject line across a dedicated monitor? The specific application is for a noisy...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.