You will have to add a few Resources for Email information.. And pass the sub some info .. But this should handle what you are looking for.. Make sure your email server can accept the number of emails being sent otherwise it might crap out. But this works in production.
Public Sub SendMailMessage(ByVal recepients As List(Of String), ByVal subject As String, ByVal body As String, Optional fle As List(Of String) = Nothing)
' Instantiate a new instance of MailMessage
' Set the sender address of the mail message
Dim mMailMessage As New MailMessage() With {
.From = New MailAddress(My.Resources.AdminEmailUserName + "@domain.com")
}
' Set the recepient address of the mail message
For Each r As String In recepients
mMailMessage.To.Add(New MailAddress(r))
Next
' Set the subject of the mail message
mMailMessage.Subject = Mid(subject, 1, 50)
' Set the body of the mail message
mMailMessage.Body = body
If fle IsNot Nothing Then
For x As Integer = 0 To fle.Count - 1
If Not String.IsNullOrEmpty(fle.Item(x)) Then
mMailMessage.Attachments.Add(New Attachment(fle.Item(x)))
End If
Next
End If
' Set the format of the mail message body as HTML
mMailMessage.IsBodyHtml = True
' Set the priority of the mail message to normal
mMailMessage.Priority = MailPriority.Normal
' Instantiate a new instance of SmtpClient
'mSmtpClient.EnableSsl = True
Dim mSmtpClient As New SmtpClient() With {
.Host = My.Resources.ExchServer,
.Port = 587,
.Credentials = New NetworkCredential(My.Resources.AdminEmailUserName, My.Resources.AdminEmailPassword)
}
' Send the mail message
mSmtpClient.Send(mMailMessage)
End Sub