使用VB.NET验证电子邮件(检查电子邮件地址是否存在)。 [英] Email Verify using VB.NET (Check if Email Address Exists).

查看:128
本文介绍了使用VB.NET验证电子邮件(检查电子邮件地址是否存在)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在创建一个程序来验证电子邮件是否存在。我发现了一个代码,但是当我尝试使用它时,运行时会在程序读取响应字符串时停止 ResponseString = reader.ReadLine()



下面是代码(我刚刚转换了这个VB.NET,原始代码是C#)

Hi everyone,
I'm creating a program that verify an email if it exists. I found a code on doing this but when I try using it, the runtime stops "ResponseString = reader.ReadLine()" when the program reading the response string.

Below is the code (I just converted this t VB.NET the original code is C#)

Dim server As String = "server.com"
Dim port As Integer = 25
Try
    Dim client As New TcpClient(server, port)
    Dim CRLF As String = "\r\n"
    Dim dataBuffer As Byte()
    Dim ResponseString As String
    Dim netStream As NetworkStream = client.GetStream()
    Dim reader As StreamReader = New StreamReader(netStream)

    'I put a breakoint here
    ResponseString = reader.ReadLine()
    dataBuffer = BytesFromString("HELO HI" + CRLF)
    netStream.Write(dataBuffer, 0, dataBuffer.Length)
    'Code Stops Here
    ResponseString = reader.ReadLine()

    dataBuffer = BytesFromString("MAIL FROM:mailFrom@server.com" + CRLF)
    netStream.Write(dataBuffer, 0, dataBuffer.Length)
    ResponseString = reader.ReadLine()

    dataBuffer = BytesFromString("RCPT TO:rcptTo@server.com" + CRLF)
    netStream.Write(dataBuffer, 0, dataBuffer.Length)
    ResponseString = reader.ReadLine()
    MsgBox(ResponseString)

    'QUIT CONNECTION
    dataBuffer = BytesFromString("QUIT" + CRLF)
    netStream.Write(dataBuffer, 0, dataBuffer.Length)
    client.Close()
Catch ex As Exception
    MsgBox(ex.Message)
End Try





任何人都可以发布为什么会发生这种情况..



谢谢



仍然无法找到答案....

以下来源是发送,但我想检查邮件服务器中是否存在电子邮件...



Can anyone post why this happens..

Thanks

Still can't find an answer....
The below source is to send, but I want to check if email exists in Mail Server or not...

推荐答案



参考这个 [ ^ ]进行类似的讨论。
Hi,
Refer this[^] for the similar discussion.


这篇关于使用VB.NET验证电子邮件(检查电子邮件地址是否存在)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆