473,442 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Launch Email with Process.Start

I'm trying to launch the default email client from a procedure, code shown
below. I keep getting the following error:
System.ComponentModel.Win32Exception: An attempt was made to reference a
token that does not exist

What am I missing?

Imports System.Diagnostics

Sub SendMail()

Dim toEmail as string
Dim Subject as string
Dim Body as string
Dim Message as string

toEmail = "my@yahoo.com"
Subject = "Subject goes here"
Body = "Thanks for playing"

Message = "mailto:" & ToEmail & "?subject=" & Subject & "&body=" & Body
Process.Start(message)

Nov 23 '05 #1
2 9304
Try this:

Dim strTo As String = "me@myemail.com"
Dim strSubject As String = "My Subject"
Dim strBody As String = "The Body of the message goes here"

Dim strMessage As String = "mailto:" & strTo & "?subject=" &
strSubject & "&body=" & strBody
System.Diagnostics.Process.Start(strMessage)

The above works fine for me.

Crouchie1998
BA (HONS) MCP MCSE
Nov 23 '05 #2
I tried that too and get the same results.

Thanks
"Crouchie1998" <cr**********@spamcop.net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Try this:

Dim strTo As String = "me@myemail.com"
Dim strSubject As String = "My Subject"
Dim strBody As String = "The Body of the message goes here"

Dim strMessage As String = "mailto:" & strTo & "?subject=" &
strSubject & "&body=" & strBody
System.Diagnostics.Process.Start(strMessage)

The above works fine for me.

Crouchie1998
BA (HONS) MCP MCSE

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim Osborne | last post by:
Hi I am writing a simple winforms application that allows me to select a pdf file on disk, and have it launch Adobe Acrobat. In the Win32 c++ world I would just do a ShellExecute. How can...
3
by: Michel H | last post by:
Hello everyone, While it seems simple to me, I just want to have a URL in my windows application that people can click and then launch the URL in the default browser. Same thing with a mailto:...
5
by: GrantS | last post by:
Hi I am trying to use ShellExecute to launch an application to display a certain file. The variation on the theme is that I need to be able to specify the application to launch and not simply...
7
by: Steve | last post by:
I used System.Diagnostics.Process.Start(str) to launch application. str is based on the registry setting, in registry, it might be str = rundll32.exe...
7
by: Christopher C | last post by:
I am using a C# winform to launch some apps for our students. Basically the user hits a button the form hides and the app is launched. When the app exits, the form is unhidden. I have a question on...
5
by: Kevin Hodgson | last post by:
I'm trying to launch a command line utility from my VB.NET App, In my function I create a process and launch the executable, and need to wait for it to exit, so that the calling code can move the...
4
by: Patrick Dugan | last post by:
I am trying to launch a vbscript from within vb.net (vs2005) The script itself requires a parameter of a filename to process. I have tried: Dim P As Process =...
5
by: jmsxp | last post by:
Hi all, I am in my infancy with programming, so please forgive stupid questions... I am attempting to write a C# program that will launch Trillian (well, that is just a part of the overall...
6
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I am deploying vb2005 apps using Click Once deployment. This works fine. The problem is that the user needs to be able to launch a 2nd app from the 1st app, but the application...
3
by: LordHog | last post by:
Hello, How would I go about finding the default handler, let's say a text file (*.txt), then launch the default handler with the file as an argument? I had found how to launch an external...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.