Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 22nd, 2006, 10:51 AM
Authorized User
Join Date: Sep 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can we connect yahoo,msn mail accounts using TCP?

Hi all,
can we connect yahoo,msn (or any) mail accounts using Sockets.TcpClient?
I yes how to doi it?what port number I've to use?

My code is like this

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' ReadMail("website url", "userid", "password")

End Sub

Function ReadMail(ByVal host As String, ByVal user As String, ByVal pass As String)
' initialise objects
Dim netstream As System.Net.Sockets.NetworkStream
Dim thisResponse As String

tcpC.Connect(host, 110)
Catch ex As Exception
End Try

netstream = tcpC.GetStream()
thisResponse = GetResponse(netstream)

thisResponse = SendCommand(netstream, "user " & user & vbCrLf)

thisResponse = SendCommand(netstream, "pass " & pass & vbCrLf)

If Not Left(thisResponse, 4) = "-ERR" Then
Response.Write("Logged in OK <BR>")
Response.Write("Error logging in, check your user details and try again<BR>")
Response.Write("<P>" & thisResponse & "</p>")
End If
End Sub

Function SendCommand(ByRef netstream As System.Net.Sockets.NetworkStream, ByVal sToSend As String)
Dim bData() As Byte = Encoding.ASCII.GetBytes(sToSend.ToCharArray)
netstream.Write(bData, 0, bData.Length())
Return GetResponse(netstream)
End Function

Function GetResponse(ByRef netstream As System.Net.Sockets.NetworkStream)
Dim bytes(tcpC.ReceiveBufferSize) As Byte
Dim ret As Integer = netstream.Read(bytes, 0, bytes.Length)

Dim returndata As String = Encoding.ASCII.GetString(bytes)
Return returndata
End Function

It's working for my companys mail id (mailserver is connected in LAN)..if i use yahoo userid and password..its showing message

No connection could be made because the target machine actively refused it

How to do this?


Old September 22nd, 2006, 11:35 AM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

dont double post.


--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to implement tabs like yahoo mail gabrieldcr2 ASP.NET 2.0 Professional 0 October 4th, 2008 08:53 AM
Can we connect yahoo,msn mail accounts using TCP? suryasimha ASP.NET 1.0 and 1.1 Professional 3 September 22nd, 2006 09:53 AM
mail.yahoo.com Type Login Form hunzian78@yahoo.com ASP.NET 1.0 and 1.1 Basics 5 March 14th, 2006 10:53 AM
Please help me to connect smtp mail server ansar BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 December 7th, 2004 03:40 PM
MSN / Yahoo messenger like pop up window tact_259 General .NET 4 May 12th, 2004 02:30 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.