473,404 Members | 2,178 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,404 software developers and data experts.

Receiving email with VB.NET

I am researching this topic without a satisfactory solution so far.
Please let me know which is the easiest way to receive email using VB
code. All I need is to test source address or subject line for the
right email, and then click a link inside that email.
I've seen some people suggested MAPI component, but it's missing in my
complete components list (not only in the toolbar). But I see an
Outlook Express component, which I suspect is easier to use than
Outlook or CDO objects. Anyway, I am looking for something that will
be available on any machine, and not only on one with Outlook
installed.
Nov 21 '05 #1
5 19566
What is your environment? If you have an exchange server you could use
WebDAV... which does not require Outlook.
"sophocles the wise" <ap****@nyc.rr.com> wrote in message
news:1f*************************@posting.google.co m...
I am researching this topic without a satisfactory solution so far.
Please let me know which is the easiest way to receive email using VB
code. All I need is to test source address or subject line for the
right email, and then click a link inside that email.
I've seen some people suggested MAPI component, but it's missing in my
complete components list (not only in the toolbar). But I see an
Outlook Express component, which I suspect is easier to use than
Outlook or CDO objects. Anyway, I am looking for something that will
be available on any machine, and not only on one with Outlook
installed.

Nov 21 '05 #2
Thanks for the reply :-)
I am not in Exchange environment. Just regular computer. I need my
application to run on any computer. If Outlook is a must, then let it
be... as soon as I am shown how to access its interface.

Alex

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #3
Check out Abderaware's mail products (www.abderaware.com). They're .Net
assemblies, and provide what seems to be complete functionality for
receiving email. I've used it to create an email screener for my own use, to
classify spam and delete it before running Outlook to receive my email. You
can download a copy of it, free for personal use, and evaluate it before
purchasing. They've got a whole slew of network products - FTP, SNMP, etc.

HTH,
Tom Dacon
Dacon Software Consulting

"sophocles the wise" <ap****@nyc.rr.com> wrote in message
news:1f*************************@posting.google.co m...
I am researching this topic without a satisfactory solution so far.
Please let me know which is the easiest way to receive email using VB
code. All I need is to test source address or subject line for the
right email, and then click a link inside that email.
I've seen some people suggested MAPI component, but it's missing in my
complete components list (not only in the toolbar). But I see an
Outlook Express component, which I suspect is easier to use than
Outlook or CDO objects. Anyway, I am looking for something that will
be available on any machine, and not only on one with Outlook
installed.

Nov 21 '05 #4
Hi,

I converted this c# pop3 mail class to vb.net. Maybe this will
help.

http://www.programmersheaven.com/2/Art_CSharp_3

How to use

Dim mail As New Pop3Mail

mail.Connect("mail.xxxx.net", "user", "password")

For Each msg As Pop3Mail.Pop3Message In mail.List

Trace.WriteLine(DirectCast(mail.Retrieve(msg),
Pop3Mail.Pop3Message).message)

Next

The class

Imports System.Net.Sockets

Public Class Pop3Mail

Inherits System.Net.Sockets.TcpClient

Public Class Pop3Exception

Inherits System.ApplicationException
Public Sub New(ByVal str As String)

MyBase.New(str)
End Sub 'New

End Class 'Pop3Exception

Public Class Pop3Message

Public number As Long

Public bytes As Long

Public retrieved As Boolean

Public message As String

End Class 'Pop3Message

Public Overloads Sub Connect(ByVal server As String, ByVal username As
String, ByVal password As String)

Dim message As String

Dim strResponse As String

Connect(server, 110)

strResponse = Response()

If strResponse.Substring(0, 3) <> "+OK" Then

Throw New Pop3Exception(Response)

End If

message = "USER " + username + vbCr + vbLf

Write(message)

strResponse = Response()

If strResponse.Substring(0, 3) <> "+OK" Then

Throw New Pop3Exception(strResponse)

End If

message = "PASS " + password + vbCr + vbLf

Write(message)

strResponse = Response()

If strResponse.Substring(0, 3) <> "+OK" Then

Throw New Pop3Exception(strResponse)

End If

End Sub 'Connect

Public Sub Disconnect()

Dim message As String

Dim strResponse As String

message = "QUIT" + vbCr + vbLf

Write(message)

strResponse = Response()

If strResponse.Substring(0, 3) <> "+OK" Then

Throw New Pop3Exception(strResponse)

End If

End Sub 'Disconnect

Public Function List() As ArrayList

Dim message As String

Dim strResponse As String

Dim retval As New ArrayList

message = "LIST" + vbCr + vbLf

Write(message)

strResponse = Response()

If strResponse.Substring(0, 3) <> "+OK" Then

Throw New Pop3Exception(strResponse)

End If

While True

strResponse = Response()

If strResponse = "." & vbCr & vbLf Then

Return retval

Else

Dim msg As New Pop3Message

Dim seps As Char() = " ".ToCharArray

Dim values As String() = strResponse.Split(seps)

msg.number = Int32.Parse(values(0))

msg.bytes = Int32.Parse(values(1))

msg.retrieved = False

retval.Add(msg)

End If

End While

End Function 'List

Public Function Retrieve(ByVal rhs As Pop3Message) As Pop3Message

Dim message As String

Dim strResponse As String

Dim msg As New Pop3Message

msg.bytes = rhs.bytes

msg.number = rhs.number

message = "RETR " & rhs.number & vbCr & vbLf

Write(message)

strResponse = Response()

If strResponse.Substring(0, 3) <> "+OK" Then

Throw New Pop3Exception(strResponse)

End If

msg.retrieved = True

While True

strResponse = Response()

If strResponse = "." & vbCr & vbLf Then

Exit While

Else

msg.message += strResponse

End If

End While

Return msg

End Function 'Retrieve

Private Sub Write(ByVal message As String)

Dim en As New System.Text.ASCIIEncoding

Dim WriteBuffer(1023) As Byte

WriteBuffer = en.GetBytes(message)

Dim stream As NetworkStream = GetStream()

stream.Write(WriteBuffer, 0, WriteBuffer.Length)

Debug.WriteLine("WRITE:" + message)

End Sub 'Write

Public Sub Delete(ByVal rhs As Pop3Message)

Dim message As String

Dim strResponse As String

message = "DELE " & rhs.number & vbCr & vbLf

Write(message)

strResponse = Response()

If strResponse.Substring(0, 3) <> "+OK" Then

Throw New Pop3Exception(strResponse)

End If

End Sub 'Delete

Private Function Response() As String

Dim enc As New System.Text.ASCIIEncoding

Dim serverbuff() As Byte = New [Byte](1023) {}

Dim stream As NetworkStream = GetStream()

Dim count As Integer = 0

While True

Dim buff() As Byte = New [Byte](1) {}

Dim bytes As Integer = stream.Read(buff, 0, 1)

If bytes = 1 Then

serverbuff(count) = buff(0)

count += 1

If buff(0) = Asc(vbLf) Then

Exit While

End If

Else

Exit While

End If

End While

Dim retval As String = enc.GetString(serverbuff, 0, count)

Debug.WriteLine("READ:" + retval)

Return retval

End Function 'Response

End Class

Ken

---------------------------------
"sophocles the wise" <ap****@nyc.rr.com> wrote in message
news:1f*************************@posting.google.co m...
I am researching this topic without a satisfactory solution so far.
Please let me know which is the easiest way to receive email using VB
code. All I need is to test source address or subject line for the
right email, and then click a link inside that email.
I've seen some people suggested MAPI component, but it's missing in my
complete components list (not only in the toolbar). But I see an
Outlook Express component, which I suspect is easier to use than
Outlook or CDO objects. Anyway, I am looking for something that will
be available on any machine, and not only on one with Outlook
installed.
Nov 21 '05 #5
Sophocles,
Anyway, I am looking for something that will
be available on any machine, and not only on one with Outlook
installed. In addition to the other 3rd party suggestions.

Matthew MacDonald's book "Microsoft Visual Basic .NET Programmer's Cookbook"
from MS Press has a topic on how to retrieve email using POP3, complete with
a sample class.

Hope this helps
Jay

"sophocles the wise" <ap****@nyc.rr.com> wrote in message
news:1f*************************@posting.google.co m...I am researching this topic without a satisfactory solution so far.
Please let me know which is the easiest way to receive email using VB
code. All I need is to test source address or subject line for the
right email, and then click a link inside that email.
I've seen some people suggested MAPI component, but it's missing in my
complete components list (not only in the toolbar). But I see an
Outlook Express component, which I suspect is easier to use than
Outlook or CDO objects. Anyway, I am looking for something that will
be available on any machine, and not only on one with Outlook
installed.

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: aa | last post by:
If I pass parameters to a PHP script in URL like ..php?a=aa&b=bb how do I recover them on the receiving PHP end? I looked at the list of PHP Variables using phpinfo() and found nothing suitable
4
by: Ramiro Barbosa, Jr. | last post by:
All, In regards to the call below, I was wondering why is it that the 'szMessage' receiving buffer results in an empty one, but by printing 'ret' it indicates the number of bytes I am indeed...
1
by: Sajsal | last post by:
Hi all I am developing a web app in which the client wants an email sending and receiving functionality. Is it possible in C#. If yes where should I start. If anyone could tell that how long...
0
by: André Betz | last post by:
Hi, I've established a TCP-Socket Connection and now I want to receive datas. So I called BeginReceive where I set the receiving buffer and length. Now in the asynchronous CallBack-Function I...
1
by: Jigar Mehta | last post by:
Hye friends!!! Jigar Mehta from India. Currently making one program in VC++ like outlook express that sends and receives mails from the server (pop3, and smtp server only)... I can not find...
2
by: mamatha | last post by:
Hi, I want to send Email in VB to mutiple users through SMTP and receiving emails thruegh IMAP.How can i built.If any one knows the source code or URL please let me know Mamatha
1
by: Subrato | last post by:
Hi, I am very new to xml and I have this piece of code which I took off a website. The situation is that on of the website, user files up a form and it is submitted. On submission, the page should...
7
by: darthghandi | last post by:
I am having mixed results with asynchronous socket receives. Sometimes I get the right information back from the buffer, other times I get some of the data that should be in the buffer printed out...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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:
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.