Okay, I think there's a simple solution that I can't find.
I have a listbox that acts as a running log, and I need the contents to be emailed to my boss.
Currently I can only get the first item that is selected to be sent, but I want all the contents of the listbox to be in the email body.
My goal is to have the whole log in the listbox send, without having to select anything.
Thank you in advance.
I have a listbox that acts as a running log, and I need the contents to be emailed to my boss.
Currently I can only get the first item that is selected to be sent, but I want all the contents of the listbox to be in the email body.
My goal is to have the whole log in the listbox send, without having to select anything.
Thank you in advance.
VB.NET:
Dim Log
Try
Dim Mail As New MailMessage
Mail.From = New MailAddress("From@gmail.com")
Mail.To.Add("Destination@gmail.com")
Mail.Subject = "Subject "
Log = ListBox1.Text 'What do I put here to select all contents of the listbox?
Mail.Body = Log
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.Port = 587
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("Destination@gmail.com", "Password")
SMTP.Send(Mail)
MsgBox("Sent Successfully", vbInformation, "Thank you")
Catch ex As Exception
MsgBox("There was an error, sorry!", vbCritical, "fatal error")
End Try