473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem Trying to Invoke Default Email Client

I am building an aspx page on which I want to have a button, which when
clicked opens the user's default email component (Outlook, OE, etc.). I
searching the web I found the codes shown below but when I try to use it I
get the error:

Exception Details: System.ComponentModel.Win32Exception: No application is
associated with the specified file for this operation

Any thought on what I am doing wrong here?

Wayne
=============== Sample Code ================
Public Sub StartDefaultMail( _

ByVal [To] As String, _

Optional ByVal Subject As String = "", _

Optional ByVal Message As String = "" _

)

Try

Dim psi As New ProcessStartInfo

psi.UseShellExecute = True

psi.FileName = _

"mailto:" & HttpUtility.UrlEncode([To]) & _

"?subject=" & HttpUtility.UrlEncode(Subject) & _

"&body=" & HttpUtility.UrlEncode(Message)

Process.Start(psi)

Catch ex As Exception

Throw _

New Exception( _

"Default mail client could not be started.", _

ex _

)

End Try

End Sub

Private Sub btnSendEmail_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSendEmail.Click

StartDefaultMail( _

te**@mysite.com, _

"Enter message body here." _

)

End Sub
Nov 19 '05 #1
1 1309
Looks like you are running this server side + there is no file named like
that...

I would just use a <a href="mailto:..."> link...

Patrice

--

"Wayne Wengert" <wa***********@wengert.org> a écrit dans le message de
news:e%****************@TK2MSFTNGP14.phx.gbl...
I am building an aspx page on which I want to have a button, which when
clicked opens the user's default email component (Outlook, OE, etc.). I
searching the web I found the codes shown below but when I try to use it I
get the error:

Exception Details: System.ComponentModel.Win32Exception: No application is
associated with the specified file for this operation

Any thought on what I am doing wrong here?

Wayne
=============== Sample Code ================
Public Sub StartDefaultMail( _

ByVal [To] As String, _

Optional ByVal Subject As String = "", _

Optional ByVal Message As String = "" _

)

Try

Dim psi As New ProcessStartInfo

psi.UseShellExecute = True

psi.FileName = _

"mailto:" & HttpUtility.UrlEncode([To]) & _

"?subject=" & HttpUtility.UrlEncode(Subject) & _

"&body=" & HttpUtility.UrlEncode(Message)

Process.Start(psi)

Catch ex As Exception

Throw _

New Exception( _

"Default mail client could not be started.", _

ex _

)

End Try

End Sub

Private Sub btnSendEmail_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSendEmail.Click

StartDefaultMail( _

te**@mysite.com, _

"Enter message body here." _

)

End Sub

Nov 19 '05 #2

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

Similar topics

11
by: Abhishek | last post by:
I have a problem transfering files using sockets from pocket pc(.net compact c#) to desktop(not using .net just mfc and sockets 2 API). The socket communication is not a issue and I am able to...
1
by: bivin | last post by:
hai i am requesting your technical support. please help me. i have been working with this for five days. the problem is relating with the smtp. i am trying to send an email from the asp.net...
0
by: Mike Grace | last post by:
Hi, I am writing a web site which sends order confirmations to users via email. Two changes that are needed are as follows: 1) PDF files are going to be attached to the email. It could be...
6
by: Wayne Wengert | last post by:
I have a Windows application in which users can select one or more individuals and an email message is created which they then complete and send. I currently use MAPI for this but I want to change...
1
by: Thomee Wright | last post by:
I'm having a problem with a pair of applications I'm developing. I have a server application which interacts with several instruments, and a client app which connects to the server and provides a...
8
by: Daz | last post by:
Hi everyone. I was faced with the choice of whether my problem is indeed a PHP problem or a MySQL. I have decided it's a PHP problem as I don't experience the same problem when I execute the...
1
by: Olivier Matrot | last post by:
I have a problem with an ASP.NET 2.0 Application. A client request is processed in parrallel by two threads. After further analysis, it appears that : - There is 2 disctinct session for the...
0
by: buk110 | last post by:
Hi everyone, I'm new to using JAVA and I'm trying to interact with a web service I wrote in C# I downloaded Netbeans & followed the instructions to point to the wsdl file I navigated to my...
4
by: Jon | last post by:
I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.