Reputation: 9416
i have 3 textboxes on an asp.net page and i would like to send the text on all those textboxes as an email message body when a button is clicked. I want each text on each textbox to appear on a new line(this i can do), but i also want the lines to be bulleted. Something like
Thank you in advance.
Upvotes: 0
Views: 1490
Reputation: 13621
If you are happy with HTML in the message body then create a HTML unordered list as follows:
C#:
StringBuilder body = new StringBuilder()
.Append("<ul><li>")
.Append(txtBoxOne.Text)
.Append("</li><li>")
.Append(txtBoxTwo.Text)
.Append("</li><li>")
.Append(txtBoxThree.Text)
.Append("</li></ul>");
MailMessage mMailMessage = new MailMessage();
mMailMessage.Body = body.ToString();
mMailMessage.IsBodyHtml = true;
VB.NET:
Dim body = New StringBuilder()
body.Append("<ul><li>")
body.Append(txtBoxOne.Text)
body.Append("</li><li>")
body.Append(txtBoxTwo.Text)
body.Append("</li><li>")
body.Append(txtBoxThree.Text)
body.Append("</li></ul>")
Dim mMailMessage = New MailMessage()
mMailMessage.Body = body.ToString()
mMailMessage.IsBodyHtml = True
Upvotes: 1