使用VB.NET登录Windows Live Mail? [英] Using VB.NET to log into Windows Live Mail?

查看:88
本文介绍了使用VB.NET登录Windows Live Mail?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个程序,通过在Windows Live中输入用户名和密码来告诉您是否可以登录到电子邮件帐户。

I want to make a program that tells you if you can login to an email account or not by entering their username and password into Windows Live.

它将连接到Hotmail服务器,看看用户/通过组合是否正确。如果它可以登录,它将显示该帐户有效的标签,如果不是说该帐户无效。

It would connect to the Hotmail server and see if the user/pass combination is correct. If it can log in, it would display a label that the account is valid, if not it would say that the account is not valid.

我该怎么做这个?

确定这是完全不正确的登录代码,我从发送电子邮件借来:

Ok here's the totally incorrect code for logging in. I kind of borrowed it from sending an email:

Dim MyMailMessage As New MailMessage
MyMailMessage.From = New MailAddress(TextBox1.Text)
MyMailMessage.To.Add(TextBox1.Text)

Dim SMTP As New SmtpClient("smtp.live.com")
SMTP.Port = 25
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("textbox1.text", "textbox2.text")
SMTP.Send(MyMailMessage) // I have no idea how to get a response here... from the live server if it gives me a correct or incorrect response...

有人可以发布示例代码,如果他们有解决方案吗?因为我不知道如何使这个单独的。

Can someone post an example code if they have a solution to this? Because I have no idea how to make this single handingly.

推荐答案

dim smtp as new smtpclient("smtp.live.com",25)
dim m as new mailmessage()'message must contains from, to, etc

with smtp

.usedefaultcredentials = false 'by default this is true
.credentials = new networkcredential("usuername","password")
.enablessl = true
.ishtmlbody = true
.send(m)
'or async
'.send(m,addresof enviado)' i'm not remember well if addressof is required here
end with


public sub Enviado
msgbox("mail message sended async")
end sub

这篇关于使用VB.NET登录Windows Live Mail?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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