I'm using mail for my program, for the body I use custom html.
I also have a listbox that contains items, my question with this is: How can I add those items to the html with numeric order.
I have tried to use "for next" but inside the html code this doesn't work.
Here is the code I have for the mail:
Hope someone can help me.
Thanks
I also have a listbox that contains items, my question with this is: How can I add those items to the html with numeric order.
I have tried to use "for next" but inside the html code this doesn't work.
Here is the code I have for the mail:
VB.NET:
Private Sub SendButton_Click(sender As Object, e As System.EventArgs) Handles SendButton.Click
Dim smtpServer As New SmtpClient
Dim mail As New MailMessage
smtpServer.Credentials = New Net.NetworkCredential(My.Settings.EmailUser, My.Settings.EmailPW)
smtpServer.Port = My.Settings.EmailPort
smtpServer.Host = My.Settings.EmailHost
'smtpServer.EnableSsl = True
mail = New MailMessage
mail.From = New MailAddress(My.Settings.EmailUser)
mail.To.Add(ToTextBox.Text)
If CCTextBox.Text > "" Then
mail.CC.Add(CCTextBox.Text)
End If
mail.Subject = SubjectTextBox.Text
mail.Body = "<html><head></head>" +
"<body style='background:#FFF;'>" +
"<table width='100%' border='0'>" +
"<tr><td>Songlist for: " + SongServiceEdit1.SelectedText + ", " + DateEdit1.Text + "</td></tr>" +
"<tr><td> </td></tr>" +
"<tr><td>Worshipservice: " + SongServiceEdit1.SelectedText + "</td></tr>" +
"<tr><td>Worshipleader(s): " + LeadersEdit1.SelectedText + "</td></tr>" +
"<tr><td></td></tr>" +
"<tr><td>Songs: <br></td></tr>" +
"<tr><td>[B][COLOR="#FF0000"]This is where the code for the listbox items should go![/COLOR][/B]</td></tr>" +
"<tr><td></td></tr>" +
"<tr><td>Message:</td></tr>" +
"<tr><td>" + RichEditControl1.HtmlText + "</td></tr>" +
"</table><br><br>" +
"Created with " + Application.Title + ": " + Application.ProductVersion +
"</body></html>"
mail.IsBodyHtml = True
Try
smtpServer.Send(mail)
MessageBox.Show("Songlist Send!", "App title", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Hope someone can help me.
Thanks