Public Function SendEmail(ByVal sMailARL As ArrayList) As Boolean
Dim mailMsg As New MailMessage()
Dim arlAttached As ArrayList
Dim bReturn As Boolean
'************************************************
Dim services() As ServiceController = ServiceController.GetServices
Dim service As ServiceController
Dim blnHasSmtpService As Boolean = False
' Loop through all the services on the machine and find the SMTP Service.
For Each service In services
If service.ServiceName.ToLower = "smtpsvc" Then
blnHasSmtpService = True
Exit For
End If
Next
If Not blnHasSmtpService Then
Throw New Exception("You do not have SMTP Service installed on this " & _
"machine. Please check the Readme file for information on how " & _
"to install SMTP Service.")
End If
' Ensure the SMTP Service is running. If not, start it.
If Not service.Status = ServiceControllerStatus.Running Then
'Dim frmStatusMessage As New frmStatus()
'frmStatusMessage.Show("SMTP Service not currently running. " & _
' "Starting service...")
Try
service.Start()
'frmStatusMessage.Close()
Catch
throw new Exception("There was an error when attempting " & _
"to start SMTP Service. Please consult the Readme " & _
"file for more information.")
End Try
End If
'arlAttached = CType(sMailARL(7), ArrayList)
'If Not IsNothing(arlAttached) Then
' Dim mailAttachment As Object
' For Each mailAttachment In arlAttached
' .Attachments.Add(mailAttachment)
' Next
'End If
End With
' See the Readme file for more information.
SmtpMail.SmtpServer = "dev-server"
' Use structured error handling to attempt to send the email message and
' provide feedback to the user about the success or failure of their
' attempt.
Try
SmtpMail.Send(mailMsg)
bReturn = True
Catch exp As Exception
Throw New Exception("The following problem occurred when attempting to " & _
"send your email: " & exp.Message)
Return False
End Try
Return bReturn
End Function