-
[2008] Mailer
Code:
Imports System.Net.Mail
Public Class Mailer
Private Sub Mailer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Server, Port, User, Pass As String
Server = txtServer.Text
Port = txtPort.Text
User = txtUser.Text
Pass = txtPass.Text
End Sub
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim Server, Port, User, Pass As String
Server = txtServer.Text
Port = txtPort.Text
User = txtUser.Text
Pass = txtPass.Text
Dim message As System.Net.Mail.MailMessage
Dim smtp As New System.Net.Mail.SmtpClient(Host:=Server, Port:=Port)
If tckSsl.Checked = True Then
smtp.EnableSsl = True
Else
smtp.EnableSsl = False
End If
message = New System.Net.Mail.MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtMessage.Text)
smtp.Credentials = New System.Net.NetworkCredential(userName:=User, passWord:=Pass)
If tckLoop.Checked = True Then
While 1 = 1
smtp.Send(message)
End While
Else
smtp.Send(message)
End If
End Sub
End Class
I hope it is fairly self explanatory.
It just doesnt work.
It mails.
But wont set the From value correctly.
Any help is appreciated.
Cheers