Visual Basic form data export to Email Body

Hey guys,

I have a very basic VB form. What I want to accomplish is to export my data into the body of an email.

So, some example thoughts:

VB Form:
Ticket #
Work Performed

I want to export this data like so into my email body (Exchange)

Date: 9/10/2012                      Customer: ABC Customer
Ticket#: TKT2012-001-001

Work Performed:
Installed a Cisco router and configured the switch
Activated licenses

Any thoughts on how I can do this easily using VB 2010?

Thanks in advance!
Who is Participating?
That will not use anything from your default mail client or Outlook. It will just send out the email directly. You will need to provide it with the details of the mail server to use, any login information, and the from address etc. In fact, it sort of turns your WinForms app into an email client itself (only sending out emails)
You can set the email body to be HTML and then use a HTML table to set the proper layout.
To see how to create and send email from the WinForms application, have a look at the System.Net.Mail classes. You can build the HTML body of the email by concatenating strings as needed. For example, one can use a StringBuilder to construct the html body and use that on the MailMessage.Body property:
body.AppendFormat("Date:{0}                      Customer: {1}", txtDate.Text, txtCustomer.Text).AppendLine()
body.AppendFormat("Ticket#: {0}", txtTicketNo.Text).AppendLine()
body.AppendFormat("Work Performed:").AppendLine()

Open in new window

PBXHowTosAuthor Commented:
@MlandaT - Will that use my default email client or will it use my Outlook profile.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.