使用控件,驗證里的RegularExpressionValidator,雙擊或者拖到頁面,在其屬性列表設置其ControlToVlidate屬性
創(chuàng)新互聯(lián)建站主營新吳網(wǎng)站建設的網(wǎng)絡公司,主營網(wǎng)站建設方案,app開發(fā)定制,新吳h5成都微信小程序搭建,新吳網(wǎng)站營銷推廣歡迎新吳等地區(qū)企業(yè)咨詢
為你要輸入郵箱地址的控件,再設置ValidationExpression屬性為Internet電子郵件地址就可以了,你還可以設置errormessage屬性,為郵箱格式錯誤時顯示的錯誤提示信息。
在Identity2.0里面封裝了IIdentityMessageService接口,可以用來發(fā)送接收郵件。
看看
Imports System.Threading.Tasks
Imports System.Security.Claims
Imports Microsoft.AspNet.Identity
Imports Microsoft.AspNet.Identity.EntityFramework
Imports Microsoft.AspNet.Identity.Owin
Imports Microsoft.Owin
Imports Microsoft.Owin.Security
public function SendAsync(message as IdentityMessage) as task
dim credentialUserName = "郵箱登錄名"
dim sentFrom = "你的郵箱地址"
dim pwd= "郵箱登錄密碼";
dim client as new System.Net.Mail.SmtpClient("smtp服務器地址")
client.Port = 25'mtp郵件服務器端口
client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network
client.UseDefaultCredentials = false
dim credentials as new System.Net.NetworkCredential(credentialUserName, pwd)
client.EnableSsl = true
client.Credentials = credentials
dim mail as new System.Net.Mail.MailMessage(sentFrom, message.Destination)
mail.Subject = message.Subject
mail.Body = message.Body
return client.SendMailAsync(mail)
end function
'有兩種辦法:
'第一種需要提供用戶名和密碼連接到指定的郵箱上,既危險又低效,但是保證可以驗證。
'這個技術上需要用到?Socket、SMTP?和?POP3?通信,這里寫不完。
'第二種:由于連接到指定的郵箱太復雜,用個東西就可以驗證郵箱格式的合法性。
'注意,是格式,并不會真的查找有沒有。
Private?Sub?Command1_Click()
If?Text1?Like?"*@*.com"?Or?Text1?Like?"*@*.net"?Then
MsgBox?"有效"
Else
MsgBox?"無效"
End?If
End?Sub