本文介绍了电子邮件验证问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想问一个想解决的人.
我制作了一个登录"应用程序,用于检查带有用户名和密码作为输入的电子邮件地址.作为输出,它将向我显示包含内容您的电子邮件和密码正确!"的msgbox.是否.

问题是在代码末尾.
请尝试帮助我. . .

有一个代码:

Hi,I have a question for anyone who knows to resolve.
I making an "sign in" application for checking email address with username and password as input.As output it will show me msgbox with content "Your email and password are correct!" or Not.

Problem is at the end of the code.
Please try to help me. . .

There is a code:

Imports System.Net.Mail
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Declare variables
Dim sSelectedSMTPServer As String = ""
Dim iSelectedSMTPPort As Integer

'Check wich email account is selected and provide correct smtp address / port.
Select Case True
Case CheckBox1.Checked
sSelectedSMTPServer = "smtp.gmail.com"
iSelectedSMTPPort = 587
Case CheckBox2.Checked
sSelectedSMTPServer = "smtp.live.com"
iSelectedSMTPPort = 587
Case CheckBox3.Checked
sSelectedSMTPServer = "smtp.mail.yahoo.com"
iSelectedSMTPPort = 465
Case Else
'If no account is selected you will get a message and the program will not attempt to send the email.
MsgBox("Please choose your email service.", vbInformation)
End Select
'For multiple selection
If CheckBox1.Checked And CheckBox2.Checked Then
MsgBox("You must select only one email service.", vbInformation)
ElseIf CheckBox1.Checked And CheckBox3.Checked Then
MsgBox("You must select only one email service.", vbInformation)
ElseIf CheckBox2.Checked And CheckBox3.Checked Then
MsgBox("You must select only one email service.", vbInformation)
ElseIf CheckBox1.Checked And CheckBox2.Checked And CheckBox3.Checked Then
MsgBox("You must select only one email service.", vbInformation)
End If

Exit Sub

Dim SMTP As New SmtpClient
'SSL enabled for outgoing mail.
SMTP.EnableSsl = True
'Get login credentials.
SMTP.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
'SMTP Port that will be used.
SMTP.Port = iSelectedSMTPPort

Try
'What???
MsgBox("Successfully logged", MsgBoxStyle.Information, "Report")
Me.Close()
Catch ex As Exception
MsgBox("Unsuccessfully logged", MsgBoxStyle.Exclamation, "Report")
End Try
End Sub

推荐答案


这篇关于电子邮件验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 16:56
查看更多