topsykretts
Well-known member
- Joined
- Dec 22, 2011
- Messages
- 47
- Programming Experience
- Beginner
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.
There is a code:
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.
There is a code:
VB.NET:
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