Hi:
If someone wouldn't mind helping me out. I have some code from an example from reachmail.net. It was in C# but I've refactored it to vb.net. But, I'm ignorant and although I can follow all of the code (it's very simple code) - I have no idea what one line is doing or why it is there...
It's a little embarassing...
Here's the line
and here is the context...
Any guidance and explanation would be very much appreciated!
By the way - no, I am not building a spammer app - I am building an SMTP connection inside an application so that a major failure can send an email to engineers responsible for the task the app does.
!NoItAl (the ! says it all)
If someone wouldn't mind helping me out. I have some code from an example from reachmail.net. It was in C# but I've refactored it to vb.net. But, I'm ignorant and although I can follow all of the code (it's very simple code) - I have no idea what one line is doing or why it is there...
It's a little embarassing...
Here's the line
Code:
System.Net.ServicePointManager.ServerCertificateValidationCallback = Function(s, ce, ca, p) True
Code:
Imports System.Net.Mail
Public Class SendViaES
Public WithEvents client As New System.Net.Mail.SmtpClient()
Private bSent As Boolean = False
Public Sub easyTest()
bSent = False
Dim smtp_host As String = "ssrs.reachmail.net"
Dim smtp_port As Integer = 25
Dim user As String = "username"
Dim pswd As String = "Password"
Dim rcpt As String = "name@domain.com"
Dim from As String = "name@domain.com"
Dim Subject As String = "Brown Fox"
Dim Body As String = "The quick brown fox jumped over the lazy dogs back."
System.Net.ServicePointManager.ServerCertificateValidationCallback = Function(s, ce, ca, p) True
Dim Mail As New System.Net.Mail.MailMessage(from, rcpt, Subject, Body)
client.Host = smtp_host
client.Credentials = New System.Net.NetworkCredential(user, pswd)
client.EnableSsl = True
client.Port = smtp_port
Dim userstate As String = "test Message"
Try
client.SendAsync(Mail, userstate)
Do Until bSent = True
Application.DoEvents()
Loop
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly)
End Try
End Sub
Public Sub ClientResponse(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles client.SendCompleted
If e.Cancelled Then
MsgBox("Server cancelled!")
Else
If IsNothing(e.Error) Then
MsgBox("Email Sent!")
Else
MsgBox(e.Error.ToString)
End If
End If
bSent = True
End Sub
End Class
By the way - no, I am not building a spammer app - I am building an SMTP connection inside an application so that a major failure can send an email to engineers responsible for the task the app does.
!NoItAl (the ! says it all)