Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Visual Basic form data export to Email Body

Posted on 2012-09-10
Medium Priority
Last Modified: 2012-09-15
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!
Question by:PBXHowTos
  • 2
LVL 83

Expert Comment

ID: 38387590
You can set the email body to be HTML and then use a HTML table to set the proper layout.
LVL 31

Expert Comment

ID: 38388529
To see how to create and send email from the WinForms application, have a look at the System.Net.Mail classes. http://www.systemnetmail.com/faq/3.1.2.aspx 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


Author Comment

ID: 38389130
@MlandaT - Will that use my default email client or will it use my Outlook profile.
LVL 31

Accepted Solution

MlandaT earned 2000 total points
ID: 38390051
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)

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question