Sending E-Mail With The Users Default Program

Just use the code below. I’m sure you will want to replace the hard-coded values with parameters from a method.

Dim mailProcess As New Process()
Dim processInfo As New System.Diagnostics.ProcessStartInfo()
  processInfo.FileName = "mailto:someone@someone.com?" _
                            & "cc=someoneelse@someone.com&" _
                            & "subject=Sample Subject&" _
                            & "body=Body of Message"
  processInfo.UseShellExecute = True
  processInfo.WindowStyle = ProcessWindowStyle.Normal
  mailProcess.StartInfo = processInfo
  mailProcess.Start(processInfo)

Tip Submitted By: David McCarter

This code can be found in the open source dotNetTips.Utility assembly

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s