Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net.Mail
- Public Class Form1
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim Mail As New MailMessage
- If server.Text = "smtp.gmail.com" Then
- Gmail.Start()
- ElseIf server.Text = "smtp.live.com" Then
- Hotmail.Start()
- ElseIf server.Text = "smtp.uk.aol.com" Then
- AOL.Start()
- ElseIf server.Text = "plus.smtp.mail.yahoo.com" Then
- Yahoo.Start()
- End If
- Exit Sub
- End Sub
- Private Sub Gmail_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Yahoo.Tick
- Dim mail As New MailMessage
- mail.Bcc.Add(recipient.Text)
- mail.From = New MailAddress(username.Text)
- mail.Subject = subject.Text
- mail.Body = body.Text
- Dim SMTP As New SmtpClient(server.Text)
- SMTP.Port = 587
- SMTP.EnableSsl = True
- SMTP.Credentials = New System.Net.NetworkCredential(username.Text, password.Text)
- SMTP.Send(mail)
- End Sub
- Private Sub Yahoo_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Yahoo.Tick
- Dim mail As New MailMessage
- mail.Bcc.Add(recipient.Text)
- mail.From = New MailAddress(username.Text)
- mail.Subject = subject.Text
- mail.Body = body.Text
- Dim SMTP As New SmtpClient(server.Text)
- SMTP.Port = 465
- SMTP.EnableSsl = True
- SMTP.Credentials = New System.Net.NetworkCredential(username.Text, password.Text)
- SMTP.Send(mail)
- End Sub
- Private Sub AOL_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AOL.Tick
- Dim mail As New MailMessage
- mail.Bcc.Add(recipient.Text)
- mail.From = New MailAddress(username.Text)
- mail.Subject = subject.Text
- mail.Body = body.Text
- Dim SMTP As New SmtpClient(server.Text)
- SMTP.Port = 587
- SMTP.EnableSsl = True
- SMTP.Credentials = New System.Net.NetworkCredential(username.Text, password.Text)
- SMTP.Send(mail)
- End Sub
- Private Sub Hotmail_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotmail.Tick
- Dim mail As New MailMessage
- mail.Bcc.Add(recipient.Text)
- mail.From = New MailAddress(username.Text)
- mail.Subject = subject.Text
- mail.Body = body.Text
- Dim SMTP As New SmtpClient(server.Text)
- SMTP.Port = 25
- SMTP.EnableSsl = True
- SMTP.Credentials = New System.Net.NetworkCredential(username.Text, password.Text)
- SMTP.Send(mail)
- End Sub
- Private Sub server_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles server.SelectedIndexChanged
- If server.Text = "smtp.gmail.com" Then
- username.Text = "@gmail.com"
- ElseIf server.Text = "smtp.live.com" Then
- username.Text = "@hotmail.com"
- ElseIf server.Text = "smtp.uk.aol.com" Then
- username.Text = "@aol.com"
- ElseIf server.Text = "plus.smtp.mail.yahoo.com" Then
- username.Text = "@yahoo.com"
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement