Advertisement
Guest User

Untitled

a guest
May 8th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.27 KB | None | 0 0
  1. Imports System.Net.Mail
  2. Public Class Mailer
  3.     Private Sub Mailer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  4.         Dim Server, Port, User, Pass As String
  5.         Server = txtServer.Text
  6.         Port = txtPort.Text
  7.         User = txtUser.Text
  8.         Pass = txtPass.Text
  9.     End Sub
  10.  
  11.     Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
  12.         Dim Server, Port, User, Pass As String
  13.         Server = txtServer.Text
  14.         Port = txtPort.Text
  15.         User = txtUser.Text
  16.         Pass = txtPass.Text
  17.         Dim message As System.Net.Mail.MailMessage
  18.         Dim smtp As New System.Net.Mail.SmtpClient(Host:=Server, Port:=Port)
  19.         If tckSsl.Checked = True Then
  20.             smtp.EnableSsl = True
  21.         Else
  22.             smtp.EnableSsl = False
  23.         End If
  24.         message = New System.Net.Mail.MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtMessage.Text)
  25.         smtp.Credentials = New System.Net.NetworkCredential(userName:=User, passWord:=Pass)
  26.         If tckLoop.Checked = True Then
  27.             While 1 = 1
  28.                 smtp.Send(message)
  29.             End While
  30.         Else
  31.             smtp.Send(message)
  32.         End If
  33.     End Sub
  34. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement