473,811 Members | 3,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

E-mail address check ! who can help me???or any advice

what's the problem??

Remote_Addr = "hotmail.co m"
sFrom = "<makefrien d8@" & Remote_Addr + ">"

Dim oConnection As New TcpClient()
Try
oConnection.Sen dTimeout = 3000

oConnection.Con nect(mserver, 25) ' msserver is right for
example mx4.HOTMAIL.COM

oStream = oConnection.Get Stream()

sResponse = GetData(oStream )
sResponse = SendData(oStrea m, "HELO " & Remote_Addr & vbCrLf)
sResponse = SendData(oStrea m, "MAIL FROM: " & sFrom & vbCrLf)

If ValidResponse(s Response) Then
sResponse = SendData(oStrea m, "RCPT TO: " & sTo & vbCrLf)

If ValidResponse(s Response) Then
Return 1 'E-mail address is vaild
Else
Return 2 'wrong address
End If
End If

SendData(oStrea m, "QUIT" & vbCrLf)
oConnection.Clo se()
oStream = Nothing
Catch
Return 3 ' why go here?? no matter the address is right or
wrong.

Private Function GetData(ByRef oStream As NetworkStream) As String

Dim bResponse(1024) As Byte
Dim sResponse As String

Dim lenStream As Integer = oStream.Read(bR esponse, 0, 1024)
If lenStream 0 Then
sResponse = Encoding.ASCII. GetString(bResp onse, 0, 1024)
End If
Return sResponse
End Function
Private Function SendData(ByRef oStream As NetworkStream, ByVal sToSend
As String) As String
Dim sResponse As String

Dim bArray() As Byte = Encoding.ASCII. GetBytes(sToSen d.ToCharArray)

oStream.Write(b Array, 0, bArray.Length() )
sResponse = GetData(oStream )

Return sResponse
End Function
Private Function ValidResponse(B yVal sResult As String) As Boolean
Dim bResult As Boolean
Dim iFirst As Integer
If sResult.Length 1 Then
iFirst = CType(sResult.S ubstring(0, 1), Integer)
If iFirst < 3 Then bResult = True
End If
Return bResult
End Function
Jun 27 '08 #1
1 1350
On Apr 15, 9:59 am, "zhang" <makefrie...@16 3.comwrote:
what's the problem??

Remote_Addr = "hotmail.co m"
sFrom = "<makefrien d8@" & Remote_Addr + ">"

Dim oConnection As New TcpClient()
Try
oConnection.Sen dTimeout = 3000

oConnection.Con nect(mserver, 25) ' msserver is right for
example mx4.HOTMAIL.COM

oStream = oConnection.Get Stream()

sResponse = GetData(oStream )
sResponse = SendData(oStrea m, "HELO " & Remote_Addr & vbCrLf)
sResponse = SendData(oStrea m, "MAIL FROM: " & sFrom & vbCrLf)

If ValidResponse(s Response) Then
sResponse = SendData(oStrea m, "RCPT TO: " & sTo & vbCrLf)

If ValidResponse(s Response) Then
Return 1 'E-mail address is vaild
Else
Return 2 'wrong address
End If
End If

SendData(oStrea m, "QUIT" & vbCrLf)
oConnection.Clo se()
oStream = Nothing
Catch
Return 3 ' why go here?? no matter the address is right or
wrong.

Private Function GetData(ByRef oStream As NetworkStream) As String

Dim bResponse(1024) As Byte
Dim sResponse As String

Dim lenStream As Integer = oStream.Read(bR esponse, 0, 1024)
If lenStream 0 Then
sResponse = Encoding.ASCII. GetString(bResp onse, 0, 1024)
End If
Return sResponse
End Function

Private Function SendData(ByRef oStream As NetworkStream, ByVal sToSend
As String) As String
Dim sResponse As String

Dim bArray() As Byte = Encoding.ASCII. GetBytes(sToSen d.ToCharArray)

oStream.Write(b Array, 0, bArray.Length() )
sResponse = GetData(oStream )

Return sResponse
End Function

Private Function ValidResponse(B yVal sResult As String) As Boolean
Dim bResult As Boolean
Dim iFirst As Integer
If sResult.Length 1 Then
iFirst = CType(sResult.S ubstring(0, 1), Integer)
If iFirst < 3 Then bResult = True
End If
Return bResult
End Function
Look at your code again....

sResponse = GetData(oStream )
sResponse = SendData(oStrea m, "HELO " & Remote_Addr &
vbCrLf)
sResponse = SendData(oStrea m, "MAIL FROM: " & sFrom &
vbCrLf)

If ValidResponse(s Response) Then
sResponse = SendData(oStrea m, "RCPT TO: " & sTo &
vbCrLf)

If ValidResponse(s Response) Then
Return 1 'E-mail address is vaild
Else
Return 2 'wrong address
End If
End If

SendData(oStrea m, "QUIT" & vbCrLf)
oConnection.Clo se()
oStream = Nothing
Catch
Return 3 ' why go here?? no matter the address is right
or
wrong.

--------If there is an error in this function, i.e sResult == Nothing
then it will throw an exception -------

Private Function ValidResponse(B yVal sResult As String) As Boolean
Dim bResult As Boolean
Dim iFirst As Integer
If sResult.Length 1 Then
iFirst = CType(sResult.S ubstring(0, 1), Integer)
If iFirst < 3 Then bResult = True
End If
Return bResult
End Function

which makes the code jump straight to the catch block instantly. But
any line between the words TRY and CATCH that contain an error would
cause the application to jump straight to the catch.
---
Delete the words TRY and CATCH and watch the program run again. This
time it should fail and tell you why and where
Jun 27 '08 #2

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

Similar topics

4
5296
by: vishal | last post by:
how can i verify the email address entered by client??? is there any readily available function for that in php or mysql????? else suggest me some links for verifying email address enetered by client. thxs for help in advance.
9
4971
by: news | last post by:
There's all kinds of ways to validate an email address to make sure it's well formed and whatnot, but what about checking to see if it's a valid e-mail account? Like how you can use checkdnsrr() to check to see if a URL is valid. I know finger used to be used at one time, no? But server block finger requests, and I'm not sure many e-mail accounts out there are even fingerable type accounts anyway. Thanks for any suggestions!
16
8104
by: siliconmike | last post by:
Hi, I'm looking for a reliable script that would connect to a host and somehow determine whether an email address is valid. since getmxrr() only gets the mx records.. Links/pointers ? Mike
17
4933
by: Sue | last post by:
<html> Is there someone here that can help me validate the period as the fourth from the last character in an email address. There is other information and validation on the form I have to do but the period in the email address is the only part I am having problems with. I have posted part of my code below. Any help would be greatly appreciated. THANKS !
2
1668
by: Cherry | last post by:
Hi, I have an intranet application that should validate the Email Address from the local SMTP Server. I have tried using CDO.Message but that does not seem to have functionality to verify the Email. Please do let me know the approach for this.
117
11901
by: Steevo | last post by:
Any suggestions as to the best programs for cloaking email addresses? Many thanks -- Steevo
35
3366
by: Mika M | last post by:
Simple question: Does Framework (1.1) contain any routine to check entered email-address is valid ? It's quite easy to make own code for that purpose, but why to do if Framework (1.1) contain this kind of routine. -- Thanks in advance! Mika
3
2402
by: Tom Anderson | last post by:
Hi all, A hoary old chestnut this - any advice on how to syntactically validate an email address? I'd like to support both the display-name-and-angle-bracket and bare-address forms, and to allow everything that RFC 2822 allows (and nothing more!). Currently, i've got some regexps which recognise a common subset of possible addresses, but it would be nice to do this properly - i don't currently support quoted pairs, quoted strings, or...
0
1723
by: comp.lang.php | last post by:
I wrote a method that should check if an email address is valid. In another method I've already checked to see if $_POST exists and is well-formed, so those checks are not necessary in this scope. However, "Step 4" bothers me, and I wonder if others are as bothered as I am. /** * Validate submitted email
4
1924
by: Mike | last post by:
Hi all, In my recent ASP.NET 2.0 appl, I need to verify that the supplied email address is valid or not. So, here's my situation: - In my <profilearea, I created <isVerifiedproperty. - Suppose a new user has been created. I set the profile.isverified to false. OnCreatedUser event I'll send him an email (to the supplied email address) to verify their email address with a link in it to an ASPX page that'll do the verification, e.g:...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10384
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10395
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10130
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7667
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5553
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.