Home All Groups Group Topic Archive Search About

Email Socket Question

Author
30 Nov 2006 11:16 PM
googlegroups
I am learning vb.net and trying to create a simple program to watch
port 25 and receive email.  I do not need any advanced features. I
just need to connect, watch and grab the emails as they come.   This
seems like it should be a pretty simple but I can not seem to find any
examples in vb.net 8. Any help is appreciated. TIA

Author
30 Nov 2006 11:46 PM
Stephany Young
Well you may not need any advanced features, but you, at least, need the
basic features of an SMTP server.

I get the impression that you think an 'email' arriving at an SMTP is just a
stream of data, but it is not.

An SMTP server and a client that is sending it an 'email' carry out a
complex conversation.

As you are learning VB.NET I suggest that you avoid such a project until you
have read and are able to implement all of the core functionality as set out
in the SMTP and related RFC's.


<googlegro***@theindianmaiden.com> wrote in message
Show quoteHide quote
news:1164928617.126983.68930@f1g2000cwa.googlegroups.com...
>I am learning vb.net and trying to create a simple program to watch
> port 25 and receive email.  I do not need any advanced features. I
> just need to connect, watch and grab the emails as they come.   This
> seems like it should be a pretty simple but I can not seem to find any
> examples in vb.net 8. Any help is appreciated. TIA
>
Author
1 Dec 2006 12:14 AM
iMaiden
I am hoping to find someone who has already written the "complex
conversation" code and to study it.  Any help is appreciated.


Stephany Young wrote:
Show quoteHide quote
> Well you may not need any advanced features, but you, at least, need the
> basic features of an SMTP server.
>
> I get the impression that you think an 'email' arriving at an SMTP is just a
> stream of data, but it is not.
>
> An SMTP server and a client that is sending it an 'email' carry out a
> complex conversation.
>
> As you are learning VB.NET I suggest that you avoid such a project until you
> have read and are able to implement all of the core functionality as set out
> in the SMTP and related RFC's.
>
>
> <googlegro***@theindianmaiden.com> wrote in message
> news:1164928617.126983.68930@f1g2000cwa.googlegroups.com...
> >I am learning vb.net and trying to create a simple program to watch
> > port 25 and receive email.  I do not need any advanced features. I
> > just need to connect, watch and grab the emails as they come.   This
> > seems like it should be a pretty simple but I can not seem to find any
> > examples in vb.net 8. Any help is appreciated. TIA
> >
Author
1 Dec 2006 12:32 AM
Stephany Young
Those that have, sell their products for (in some cases) several thousand
dollars. They generally do not make the source code available.


Show quoteHide quote
"iMaiden" <googlegro***@theindianmaiden.com> wrote in message
news:1164932082.913991.251940@f1g2000cwa.googlegroups.com...
>I am hoping to find someone who has already written the "complex
> conversation" code and to study it.  Any help is appreciated.
>
>
> Stephany Young wrote:
>> Well you may not need any advanced features, but you, at least, need the
>> basic features of an SMTP server.
>>
>> I get the impression that you think an 'email' arriving at an SMTP is
>> just a
>> stream of data, but it is not.
>>
>> An SMTP server and a client that is sending it an 'email' carry out a
>> complex conversation.
>>
>> As you are learning VB.NET I suggest that you avoid such a project until
>> you
>> have read and are able to implement all of the core functionality as set
>> out
>> in the SMTP and related RFC's.
>>
>>
>> <googlegro***@theindianmaiden.com> wrote in message
>> news:1164928617.126983.68930@f1g2000cwa.googlegroups.com...
>> >I am learning vb.net and trying to create a simple program to watch
>> > port 25 and receive email.  I do not need any advanced features. I
>> > just need to connect, watch and grab the emails as they come.   This
>> > seems like it should be a pretty simple but I can not seem to find any
>> > examples in vb.net 8. Any help is appreciated. TIA
>> >
>
Author
1 Dec 2006 1:08 AM
iMaiden
I'm not here for a discussion and if you don't know how to do what I am
trying to do that is fine but perhaps you do or someone else in this
group does so here goes. How would I use sockets to

1) open port 25
2) receive data from this port
3) send data through this port
4) close the port.


Stephany Young wrote:
Show quoteHide quote
> Those that have, sell their products for (in some cases) several thousand
> dollars. They generally do not make the source code available.
>
>
> "iMaiden" <googlegro***@theindianmaiden.com> wrote in message
> news:1164932082.913991.251940@f1g2000cwa.googlegroups.com...
> >I am hoping to find someone who has already written the "complex
> > conversation" code and to study it.  Any help is appreciated.
> >
> >
> > Stephany Young wrote:
> >> Well you may not need any advanced features, but you, at least, need the
> >> basic features of an SMTP server.
> >>
> >> I get the impression that you think an 'email' arriving at an SMTP is
> >> just a
> >> stream of data, but it is not.
> >>
> >> An SMTP server and a client that is sending it an 'email' carry out a
> >> complex conversation.
> >>
> >> As you are learning VB.NET I suggest that you avoid such a project until
> >> you
> >> have read and are able to implement all of the core functionality as set
> >> out
> >> in the SMTP and related RFC's.
> >>
> >>
> >> <googlegro***@theindianmaiden.com> wrote in message
> >> news:1164928617.126983.68930@f1g2000cwa.googlegroups.com...
> >> >I am learning vb.net and trying to create a simple program to watch
> >> > port 25 and receive email.  I do not need any advanced features. I
> >> > just need to connect, watch and grab the emails as they come.   This
> >> > seems like it should be a pretty simple but I can not seem to find any
> >> > examples in vb.net 8. Any help is appreciated. TIA
> >> >
> >
Author
1 Dec 2006 4:53 AM
al jones
iMaiden (and I'm not sure you are one) if you're not here for discussion
(of programming topics), then you're really in the wrong place.  I'm more
new than not, and I've gotten a lot of help from the people here -
sometimes they surprise me with code, most of the time I get suggestions
about where to go look.  That's better for me since I have the opportunity
to see how to use the tools I have at hand rather than having someone hand
it to me on a silver platter.

If you need it so badly that you can't be polite (and 'I'm not here for
discussion...' is *not* polite) then maybe you'd better take Stephanies
inferred suggestion and go buy one ....

.... and, no, I don't know how to do what you want either; but I do know
that your approach isn't the way *I'd* handle it.

//al

On 30 Nov 2006 17:08:55 -0800, iMaiden wrote:

Show quoteHide quote
> I'm not here for a discussion and if you don't know how to do what I am
> trying to do that is fine but perhaps you do or someone else in this
> group does so here goes. How would I use sockets to
>
> 1) open port 25
> 2) receive data from this port
> 3) send data through this port
> 4) close the port.
>
> Stephany Young wrote:
>> Those that have, sell their products for (in some cases) several thousand
>> dollars. They generally do not make the source code available.
>>
>>
>> "iMaiden" <googlegro***@theindianmaiden.com> wrote in message
>> news:1164932082.913991.251940@f1g2000cwa.googlegroups.com...
>>>I am hoping to find someone who has already written the "complex
>>> conversation" code and to study it.  Any help is appreciated.
>>>
>>>
>>> Stephany Young wrote:
>>>> Well you may not need any advanced features, but you, at least, need the
>>>> basic features of an SMTP server.
>>>>
>>>> I get the impression that you think an 'email' arriving at an SMTP is
>>>> just a
>>>> stream of data, but it is not.
>>>>
>>>> An SMTP server and a client that is sending it an 'email' carry out a
>>>> complex conversation.
>>>>
>>>> As you are learning VB.NET I suggest that you avoid such a project until
>>>> you
>>>> have read and are able to implement all of the core functionality as set
>>>> out
>>>> in the SMTP and related RFC's.
>>>>
>>>>
>>>> <googlegro***@theindianmaiden.com> wrote in message
>>>> news:1164928617.126983.68930@f1g2000cwa.googlegroups.com...
>>>> >I am learning vb.net and trying to create a simple program to watch
>>>> > port 25 and receive email.  I do not need any advanced features. I
>>>> > just need to connect, watch and grab the emails as they come.   This
>>>> > seems like it should be a pretty simple but I can not seem to find any
>>>> > examples in vb.net 8. Any help is appreciated. TIA
>>>> >
>>>
Author
1 Dec 2006 6:11 AM
Cor Ligthert [MVP]
Al,

A big mistake in your message, you will be punished for many years.

It is Stephany, not Stephanie.

:-))))

Cor

Show quoteHide quote
"al jones" <alfredmjo***@shotmail.com> schreef in bericht
news:r0k091c2l29i.1w7g6oo8z8chs$.dlg@40tude.net...
> iMaiden (and I'm not sure you are one) if you're not here for discussion
> (of programming topics), then you're really in the wrong place.  I'm more
> new than not, and I've gotten a lot of help from the people here -
> sometimes they surprise me with code, most of the time I get suggestions
> about where to go look.  That's better for me since I have the opportunity
> to see how to use the tools I have at hand rather than having someone hand
> it to me on a silver platter.
>
> If you need it so badly that you can't be polite (and 'I'm not here for
> discussion...' is *not* polite) then maybe you'd better take Stephanies
> inferred suggestion and go buy one ....
>
> ... and, no, I don't know how to do what you want either; but I do know
> that your approach isn't the way *I'd* handle it.
>
> //al
>
> On 30 Nov 2006 17:08:55 -0800, iMaiden wrote:
>
>> I'm not here for a discussion and if you don't know how to do what I am
>> trying to do that is fine but perhaps you do or someone else in this
>> group does so here goes. How would I use sockets to
>>
>> 1) open port 25
>> 2) receive data from this port
>> 3) send data through this port
>> 4) close the port.
>>
>> Stephany Young wrote:
>>> Those that have, sell their products for (in some cases) several
>>> thousand
>>> dollars. They generally do not make the source code available.
>>>
>>>
>>> "iMaiden" <googlegro***@theindianmaiden.com> wrote in message
>>> news:1164932082.913991.251940@f1g2000cwa.googlegroups.com...
>>>>I am hoping to find someone who has already written the "complex
>>>> conversation" code and to study it.  Any help is appreciated.
>>>>
>>>>
>>>> Stephany Young wrote:
>>>>> Well you may not need any advanced features, but you, at least, need
>>>>> the
>>>>> basic features of an SMTP server.
>>>>>
>>>>> I get the impression that you think an 'email' arriving at an SMTP is
>>>>> just a
>>>>> stream of data, but it is not.
>>>>>
>>>>> An SMTP server and a client that is sending it an 'email' carry out a
>>>>> complex conversation.
>>>>>
>>>>> As you are learning VB.NET I suggest that you avoid such a project
>>>>> until
>>>>> you
>>>>> have read and are able to implement all of the core functionality as
>>>>> set
>>>>> out
>>>>> in the SMTP and related RFC's.
>>>>>
>>>>>
>>>>> <googlegro***@theindianmaiden.com> wrote in message
>>>>> news:1164928617.126983.68930@f1g2000cwa.googlegroups.com...
>>>>> >I am learning vb.net and trying to create a simple program to watch
>>>>> > port 25 and receive email.  I do not need any advanced features. I
>>>>> > just need to connect, watch and grab the emails as they come.   This
>>>>> > seems like it should be a pretty simple but I can not seem to find
>>>>> > any
>>>>> > examples in vb.net 8. Any help is appreciated. TIA
>>>>> >
>>>>
Author
1 Dec 2006 6:16 AM
Stephany Young
Thank you Cor. I was wondering how long it would take someone to spot that.

But really, I'm a big girl and I can spit my dummy quite well without any
help.

;)



Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:uESvL9QFHHA.2296@TK2MSFTNGP04.phx.gbl...
> Al,
>
> A big mistake in your message, you will be punished for many years.
>
> It is Stephany, not Stephanie.
>
> :-))))
>
> Cor
>
> "al jones" <alfredmjo***@shotmail.com> schreef in bericht
> news:r0k091c2l29i.1w7g6oo8z8chs$.dlg@40tude.net...
>> iMaiden (and I'm not sure you are one) if you're not here for discussion
>> (of programming topics), then you're really in the wrong place.  I'm more
>> new than not, and I've gotten a lot of help from the people here -
>> sometimes they surprise me with code, most of the time I get suggestions
>> about where to go look.  That's better for me since I have the
>> opportunity
>> to see how to use the tools I have at hand rather than having someone
>> hand
>> it to me on a silver platter.
>>
>> If you need it so badly that you can't be polite (and 'I'm not here for
>> discussion...' is *not* polite) then maybe you'd better take Stephanies
>> inferred suggestion and go buy one ....
>>
>> ... and, no, I don't know how to do what you want either; but I do know
>> that your approach isn't the way *I'd* handle it.
>>
>> //al
>>
>> On 30 Nov 2006 17:08:55 -0800, iMaiden wrote:
>>
>>> I'm not here for a discussion and if you don't know how to do what I am
>>> trying to do that is fine but perhaps you do or someone else in this
>>> group does so here goes. How would I use sockets to
>>>
>>> 1) open port 25
>>> 2) receive data from this port
>>> 3) send data through this port
>>> 4) close the port.
>>>
>>> Stephany Young wrote:
>>>> Those that have, sell their products for (in some cases) several
>>>> thousand
>>>> dollars. They generally do not make the source code available.
>>>>
>>>>
>>>> "iMaiden" <googlegro***@theindianmaiden.com> wrote in message
>>>> news:1164932082.913991.251940@f1g2000cwa.googlegroups.com...
>>>>>I am hoping to find someone who has already written the "complex
>>>>> conversation" code and to study it.  Any help is appreciated.
>>>>>
>>>>>
>>>>> Stephany Young wrote:
>>>>>> Well you may not need any advanced features, but you, at least, need
>>>>>> the
>>>>>> basic features of an SMTP server.
>>>>>>
>>>>>> I get the impression that you think an 'email' arriving at an SMTP is
>>>>>> just a
>>>>>> stream of data, but it is not.
>>>>>>
>>>>>> An SMTP server and a client that is sending it an 'email' carry out a
>>>>>> complex conversation.
>>>>>>
>>>>>> As you are learning VB.NET I suggest that you avoid such a project
>>>>>> until
>>>>>> you
>>>>>> have read and are able to implement all of the core functionality as
>>>>>> set
>>>>>> out
>>>>>> in the SMTP and related RFC's.
>>>>>>
>>>>>>
>>>>>> <googlegro***@theindianmaiden.com> wrote in message
>>>>>> news:1164928617.126983.68930@f1g2000cwa.googlegroups.com...
>>>>>> >I am learning vb.net and trying to create a simple program to watch
>>>>>> > port 25 and receive email.  I do not need any advanced features. I
>>>>>> > just need to connect, watch and grab the emails as they come.
>>>>>> > This
>>>>>> > seems like it should be a pretty simple but I can not seem to find
>>>>>> > any
>>>>>> > examples in vb.net 8. Any help is appreciated. TIA
>>>>>> >
>>>>>
>
>
Author
1 Dec 2006 2:19 PM
al jones
OOps, < chuckle > sorry, Stephany - but at least I didn't get called on the
carpet for the message .... :)

//al

On Fri, 1 Dec 2006 19:16:44 +1300, Stephany Young wrote:

Show quoteHide quote
> Thank you Cor. I was wondering how long it would take someone to spot that.
>
> But really, I'm a big girl and I can spit my dummy quite well without any
> help.
>
> ;)
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:uESvL9QFHHA.2296@TK2MSFTNGP04.phx.gbl...
>> Al,
>>
>> A big mistake in your message, you will be punished for many years.
>>
>> It is Stephany, not Stephanie.
>>
>> :-))))
>>
>> Cor
>>
>> "al jones" <alfredmjo***@shotmail.com> schreef in bericht
>> news:r0k091c2l29i.1w7g6oo8z8chs$.dlg@40tude.net...
>>> iMaiden (and I'm not sure you are one) if you're not here for discussion
>>> (of programming topics), then you're really in the wrong place.  I'm more
>>> new than not, and I've gotten a lot of help from the people here -
>>> sometimes they surprise me with code, most of the time I get suggestions
>>> about where to go look.  That's better for me since I have the
>>> opportunity
>>> to see how to use the tools I have at hand rather than having someone
>>> hand
>>> it to me on a silver platter.
>>>
>>> If you need it so badly that you can't be polite (and 'I'm not here for
>>> discussion...' is *not* polite) then maybe you'd better take Stephanies
>>> inferred suggestion and go buy one ....
>>>
>>> ... and, no, I don't know how to do what you want either; but I do know
>>> that your approach isn't the way *I'd* handle it.
>>>
>>> //al
>>>
>>> On 30 Nov 2006 17:08:55 -0800, iMaiden wrote:
>>>
>>>> I'm not here for a discussion and if you don't know how to do what I am
>>>> trying to do that is fine but perhaps you do or someone else in this
>>>> group does so here goes. How would I use sockets to
>>>>
>>>> 1) open port 25
>>>> 2) receive data from this port
>>>> 3) send data through this port
>>>> 4) close the port.
>>>>
>>>> Stephany Young wrote:
>>>>> Those that have, sell their products for (in some cases) several
>>>>> thousand
>>>>> dollars. They generally do not make the source code available.
>>>>>
>>>>>
>>>>> "iMaiden" <googlegro***@theindianmaiden.com> wrote in message
>>>>> news:1164932082.913991.251940@f1g2000cwa.googlegroups.com...
>>>>>>I am hoping to find someone who has already written the "complex
>>>>>> conversation" code and to study it.  Any help is appreciated.
>>>>>>
>>>>>>
>>>>>> Stephany Young wrote:
>>>>>>> Well you may not need any advanced features, but you, at least, need
>>>>>>> the
>>>>>>> basic features of an SMTP server.
>>>>>>>
>>>>>>> I get the impression that you think an 'email' arriving at an SMTP is
>>>>>>> just a
>>>>>>> stream of data, but it is not.
>>>>>>>
>>>>>>> An SMTP server and a client that is sending it an 'email' carry out a
>>>>>>> complex conversation.
>>>>>>>
>>>>>>> As you are learning VB.NET I suggest that you avoid such a project
>>>>>>> until
>>>>>>> you
>>>>>>> have read and are able to implement all of the core functionality as
>>>>>>> set
>>>>>>> out
>>>>>>> in the SMTP and related RFC's.
>>>>>>>
>>>>>>>
>>>>>>> <googlegro***@theindianmaiden.com> wrote in message
>>>>>>> news:1164928617.126983.68930@f1g2000cwa.googlegroups.com...
>>>>>>> >I am learning vb.net and trying to create a simple program to watch
>>>>>>> > port 25 and receive email.  I do not need any advanced features. I
>>>>>>> > just need to connect, watch and grab the emails as they come.
>>>>>>> > This
>>>>>>> > seems like it should be a pretty simple but I can not seem to find
>>>>>>> > any
>>>>>>> > examples in vb.net 8. Any help is appreciated. TIA
>>>>>>> >
>>>>>>
>>
>>
Author
1 Dec 2006 2:25 AM
Spam Catcher
"iMaiden" <googlegro***@theindianmaiden.com> wrote in
news:1164932082.913991.251940@f1g2000cwa.googlegroups.com:

> I am hoping to find someone who has already written the "complex
> conversation" code and to study it.  Any help is appreciated.

Start off with something simple - like a hello world socket code.

A SMTP server is not that trival :-)
Author
1 Dec 2006 2:54 AM
iMaiden
That would be a great start. can someone post or point me to such an
example?
Spam Catcher wrote:
Show quoteHide quote
> "iMaiden" <googlegro***@theindianmaiden.com> wrote in
> news:1164932082.913991.251940@f1g2000cwa.googlegroups.com:
>
> > I am hoping to find someone who has already written the "complex
> > conversation" code and to study it.  Any help is appreciated.
>
> Start off with something simple - like a hello world socket code.
>
> A SMTP server is not that trival :-)
Author
1 Dec 2006 4:23 AM
Tom Shelton
On 2006-11-30, googlegro***@theindianmaiden.com <googlegro***@theindianmaiden.com> wrote:
> I am learning vb.net and trying to create a simple program to watch
> port 25 and receive email.  I do not need any advanced features. I
> just need to connect, watch and grab the emails as they come.   This
> seems like it should be a pretty simple but I can not seem to find any
> examples in vb.net 8. Any help is appreciated. TIA
>

Ok...  First things first - you need to understand how to write a server in
VB.NET.  For an SMTP server, I think the first thing you should look at is how
to write a basic windows service.  You should be able to find examples of that
in the documentation - Look at System.ServiceProcess.ServiceBase.

Once you have that down, you should probably read and study the documentation
on implementing an ayncronous server socket.  I encourage you to use the
asyncronous model, even though it is slightly more complicated then the normal
syncronous socket model.  It will provide you with much better overall
performance because of the way the async sockets are implemented.  There is a
example of a simple server in the documentation.  If you don't have the docs,
start here:

http://msdn2.microsoft.com/en-us/library/4as0wz7t.aspx

Once you understand the basic concepts, then you should go to an rfc database
(I usually go to http://www.rfc-editor.org) and look up the rfc's related to
smtp.  You should probably start with rfc2821:

ftp://ftp.rfc-editor.org/in-notes/rfc2821.txt

Then you will probably want to expand from there, like the rfc2554 which
covers service extensions for authentication, etc.

Once you begin writing code and playing with it - post back if you have any
questions.  It's much easier to help people with specific issues then the
general "how do i write an smtp server" :)

HTH

--
Tom Shelton
Author
1 Dec 2006 4:28 AM
Branco Medeiros
googlegro***@theindianmaiden.com wrote:
> I am learning vb.net and trying to create a simple program to watch
> port 25 and receive email.  I do not need any advanced features. I
> just need to connect, watch and grab the emails as they come.   This
> seems like it should be a pretty simple but I can not seem to find any
> examples in vb.net 8. Any help is appreciated. TIA

TCPListener is your friend (It's in System.Net.Sockets).

HTH.

Regards,

Branco.
Author
1 Dec 2006 6:54 PM
iMaiden
Thanks Branco

Dim Listener As New TcpListener("25")
        Listening = True
        Listener.Start()
        Do Until Listening = False
            Dim sb As New SocketAndBuffer()
            sb.Socket = Listener.AcceptSocket()
            sb.Socket.BeginReceive(sb.Buffer, 0, sb.Buffer.Length,
SocketFlags.None, AddressOf ReceiveCallBack, sb)
        Loop


Branco Medeiros wrote:
Show quoteHide quote
> googlegro***@theindianmaiden.com wrote:
> > I am learning vb.net and trying to create a simple program to watch
> > port 25 and receive email.  I do not need any advanced features. I
> > just need to connect, watch and grab the emails as they come.   This
> > seems like it should be a pretty simple but I can not seem to find any
> > examples in vb.net 8. Any help is appreciated. TIA
>
> TCPListener is your friend (It's in System.Net.Sockets).
>
> HTH.
>
> Regards,
>
> Branco.
Author
6 Dec 2006 8:12 PM
iMaiden
Completed simple server to receive mail. Thanks for you help.

Sub ListenToServer()
        'Try

        Dim LISTENING As Boolean
        Dim localhostAddress As IPAddress =
ipAddress.Parse(ipAddress.ToString)
        Dim port As Integer = 25      '' PORT ADDRESS
        ''''''''''' making socket tcpList ''''''''''''''''
        Dim tcpList As New TcpListener(localhostAddress, port)
        Try
            tcpList.Start()
            LISTENING = True

            Do While LISTENING

                Do While tcpList.Pending = False And LISTENING = True
                    ' Yield the CPU for a while.
                    Thread.Sleep(10)
                Loop
                If Not LISTENING Then Exit Do

                Dim tcpCli As TcpClient = tcpList.AcceptTcpClient()
                Dim ns As NetworkStream = tcpCli.GetStream
                Dim sr As New StreamReader(ns)

                Dim returnedData As String = "220 smtp.sample.com SMTP
server ready"
                Dim sw As New StreamWriter(ns)
                sw.WriteLine(returnedData)
                sw.Flush()
                Dim receivedData As String = sr.ReadLine()
                sw.Flush()


                returnedData = "250 smtp.sample.com Hello
[71.105.78.90]"
                sw.WriteLine(returnedData)
                sw.Flush()
                receivedData = sr.ReadLine()
                receivedData = Trim(Replace(LCase(receivedData), "mail
from:", ""))

                returnedData = "250 " + receivedData + "....Sender OK"
                sw.WriteLine(returnedData)
                sw.Flush()
                receivedData = sr.ReadLine()


                returnedData = "250 " +
Trim(Replace(LCase(receivedData), "rcpt to:", ""))
                sw.WriteLine(returnedData)
                sw.Flush()
                receivedData = sr.ReadLine()


                returnedData = "354 Start mail input; end with
<CRLF>.<CRLF>"
                sw.WriteLine(returnedData)
                sw.Flush()

                Do While receivedData <> "."

                    receivedData = sr.ReadLine()
                    sw.Flush()
                    MsgBox(receivedData)

                Loop
                MsgBox("OVER")
                returnedData = "250 Queued mail for delivery"
                sw.WriteLine(returnedData)
                sw.Flush()

                sr.Close()
                sw.Close()
                ns.Close()
                tcpCli.Close()
            Loop
            tcpList.Stop()
        Catch ex As Exception
            'error
            LISTENING = False
        End Try
    End Sub
iMaiden wrote:
Show quoteHide quote
> Thanks Branco
>
> Dim Listener As New TcpListener("25")
>         Listening = True
>         Listener.Start()
>         Do Until Listening = False
>             Dim sb As New SocketAndBuffer()
>             sb.Socket = Listener.AcceptSocket()
>             sb.Socket.BeginReceive(sb.Buffer, 0, sb.Buffer.Length,
> SocketFlags.None, AddressOf ReceiveCallBack, sb)
>         Loop
>
>
> Branco Medeiros wrote:
> > googlegro***@theindianmaiden.com wrote:
> > > I am learning vb.net and trying to create a simple program to watch
> > > port 25 and receive email.  I do not need any advanced features. I
> > > just need to connect, watch and grab the emails as they come.   This
> > > seems like it should be a pretty simple but I can not seem to find any
> > > examples in vb.net 8. Any help is appreciated. TIA
> >
> > TCPListener is your friend (It's in System.Net.Sockets).
> >
> > HTH.
> >
> > Regards,
> >
> > Branco.
Author
1 Dec 2006 4:48 AM
Cor Ligthert [MVP]
I never used it, but Chad tells always that the software is on his site.

http://www.indyproject.org/

I hope this helps,

Cor

<googlegro***@theindianmaiden.com> schreef in bericht
Show quoteHide quote
news:1164928617.126983.68930@f1g2000cwa.googlegroups.com...
>I am learning vb.net and trying to create a simple program to watch
> port 25 and receive email.  I do not need any advanced features. I
> just need to connect, watch and grab the emails as they come.   This
> seems like it should be a pretty simple but I can not seem to find any
> examples in vb.net 8. Any help is appreciated. TIA
>