Advertisement
Guest User

Untitled

a guest
Jun 18th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.18 KB | None | 0 0
  1. Imports System.Net.Mail
  2.  
  3. Public Class Form1
  4.  
  5.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  6.         Dim Mail As New MailMessage
  7.         If server.Text = "smtp.gmail.com" Then
  8.             Gmail.Start()
  9.         ElseIf server.Text = "smtp.live.com" Then
  10.             Hotmail.Start()
  11.         ElseIf server.Text = "smtp.uk.aol.com" Then
  12.             AOL.Start()
  13.         ElseIf server.Text = "plus.smtp.mail.yahoo.com" Then
  14.             Yahoo.Start()
  15.         End If
  16.         Exit Sub
  17.     End Sub
  18.  
  19.     Private Sub Gmail_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Yahoo.Tick
  20.         Dim mail As New MailMessage
  21.         mail.Bcc.Add(recipient.Text)
  22.         mail.From = New MailAddress(username.Text)
  23.         mail.Subject = subject.Text
  24.         mail.Body = body.Text
  25.         Dim SMTP As New SmtpClient(server.Text)
  26.         SMTP.Port = 587
  27.         SMTP.EnableSsl = True
  28.         SMTP.Credentials = New System.Net.NetworkCredential(username.Text, password.Text)
  29.         SMTP.Send(mail)
  30.     End Sub
  31.  
  32.     Private Sub Yahoo_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Yahoo.Tick
  33.         Dim mail As New MailMessage
  34.         mail.Bcc.Add(recipient.Text)
  35.         mail.From = New MailAddress(username.Text)
  36.         mail.Subject = subject.Text
  37.         mail.Body = body.Text
  38.         Dim SMTP As New SmtpClient(server.Text)
  39.         SMTP.Port = 465
  40.         SMTP.EnableSsl = True
  41.         SMTP.Credentials = New System.Net.NetworkCredential(username.Text, password.Text)
  42.         SMTP.Send(mail)
  43.  
  44.     End Sub
  45.  
  46.     Private Sub AOL_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AOL.Tick
  47.         Dim mail As New MailMessage
  48.         mail.Bcc.Add(recipient.Text)
  49.         mail.From = New MailAddress(username.Text)
  50.         mail.Subject = subject.Text
  51.         mail.Body = body.Text
  52.         Dim SMTP As New SmtpClient(server.Text)
  53.         SMTP.Port = 587
  54.         SMTP.EnableSsl = True
  55.         SMTP.Credentials = New System.Net.NetworkCredential(username.Text, password.Text)
  56.         SMTP.Send(mail)
  57.     End Sub
  58.  
  59.     Private Sub Hotmail_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotmail.Tick
  60.         Dim mail As New MailMessage
  61.         mail.Bcc.Add(recipient.Text)
  62.         mail.From = New MailAddress(username.Text)
  63.         mail.Subject = subject.Text
  64.         mail.Body = body.Text
  65.         Dim SMTP As New SmtpClient(server.Text)
  66.         SMTP.Port = 25
  67.         SMTP.EnableSsl = True
  68.         SMTP.Credentials = New System.Net.NetworkCredential(username.Text, password.Text)
  69.         SMTP.Send(mail)
  70.     End Sub
  71. Private Sub server_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles server.SelectedIndexChanged
  72.     If server.Text = "smtp.gmail.com" Then
  73.             username.Text = "@gmail.com"
  74.         ElseIf server.Text = "smtp.live.com" Then
  75.             username.Text = "@hotmail.com"
  76.     ElseIf server.Text = "smtp.uk.aol.com" Then
  77.             username.Text = "@aol.com"
  78.     ElseIf server.Text = "plus.smtp.mail.yahoo.com" Then
  79.             username.Text = "@yahoo.com"
  80.     End If
  81. End Sub
  82. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement