473,396 Members | 1,734 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.

Invoke standard mail client

Hello experts,

I'm coding a routine which should open a new mail form of the mail standard
mail client installed on a system (e.g. outlook, outlook express, netscape
mail, etc.) for support reasons. The routine should fill in some textual
information. It should, however, not mail the information directly. The user
should be able to check the contents of the mail and he should be able to
edit the mail before sending it.
Consequently, I have the simple question: Is there any method in visual
basic (.net) to force the standard mail client of a machine to open a new
form (like mailto:... in HTML) and fill in some information?

Best regards,

John
Nov 20 '05 #1
9 1679
You can use shellexecute api call and pass mailto:yo*********@xyz.com in the
lpfile paramater.

Vikram
"John Lafrowda" <la*****@laa.com> wrote in message
news:bv**********@news.uni-stuttgart.de...
Hello experts,

I'm coding a routine which should open a new mail form of the mail standard mail client installed on a system (e.g. outlook, outlook express, netscape
mail, etc.) for support reasons. The routine should fill in some textual
information. It should, however, not mail the information directly. The user should be able to check the contents of the mail and he should be able to
edit the mail before sending it.
Consequently, I have the simple question: Is there any method in visual
basic (.net) to force the standard mail client of a machine to open a new
form (like mailto:... in HTML) and fill in some information?

Best regards,

John

Nov 20 '05 #2
Cor
Hi John,

Not only one more, the most simple one I think is the one I have pasted in
bellow.
When you paste it in your IDE it looks nice again. :-)
It is really easy but complete and therefore it looks now maybe complex.

\\\by Fergus Cooney & small corrections by Cor
'A reference to System.Web may be necessary
'in the Project for this Import to work.
Imports System.Web.HttpUtility

Public Sub StartDefaultMail (sTo As String, _
Optional sSubject As String = "", _
Optional sMessage As String = "")
Try
sTo = UrlEncode (sTo)
sSubject = sSubject
sMessage = sMessage
Process.Start ("mailto:" & sTo & "?subject=" _
& sSubject & "&body=" & sMessage)

Catch e As Exception
MsgBox ("Couldn't start default email application" _
& vbCrLf & e.Message)
'or
Throw New Exception ("Couldn't start default email app", e)
End Try
End Sub
///

I hope this helps a little bit?

Cor

I'm coding a routine which should open a new mail form of the mail standard mail client installed on a system (e.g. outlook, outlook express, netscape
mail, etc.) for support reasons. The routine should fill in some textual
information. It should, however, not mail the information directly. The user should be able to check the contents of the mail and he should be able to
edit the mail before sending it.
Consequently, I have the simple question: Is there any method in visual
basic (.net) to force the standard mail client of a machine to open a new
form (like mailto:... in HTML) and fill in some information?

Nov 20 '05 #3
* "Cor" <no*@non.com> scripsit:
\\\by Fergus Cooney & small corrections by Cor
'A reference to System.Web may be necessary
'in the Project for this Import to work.
Imports System.Web.HttpUtility

Public Sub StartDefaultMail (sTo As String, _
Optional sSubject As String = "", _
Optional sMessage As String = "")
Try
sTo = UrlEncode (sTo)
sSubject = sSubject
sMessage = sMessage
Process.Start ("mailto:" & sTo & "?subject=" _
& sSubject & "&body=" & sMessage)

Catch e As Exception
MsgBox ("Couldn't start default email application" _
& vbCrLf & e.Message)
'or
Throw New Exception ("Couldn't start default email app", e)
End Try
End Sub
///


Why did the code loose all indentations?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Cor
>Why did the code loose all indentations?

Because I have made my HKW database with a function to do that for me.

:-)

But Fergus also said it was not nice looking what is your opinion?

Cor

Nov 20 '05 #5
Cor,

* "Cor" <no*@non.com> scripsit:
Why did the code loose all indentations?


Because I have made my HKW database with a function to do that for me.

:-)

But Fergus also said it was not nice looking what is your opinion?


Mhm... I prefer indented code even in newsgroup posts because it makes
reading the code much easier. Just a thought.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
Cor
Will be changed,

Herr Herfried
Sir Fergus

:-))

Cor
But Fergus also said it was not nice looking what is your opinion?


Mhm... I prefer indented code even in newsgroup posts because it makes
reading the code much easier. Just a thought.

Nov 20 '05 #7
Cor,

* "Cor" <no*@non.com> scripsit:
Will be changed,

Herr Herfried
Sir Fergus

:-))


:-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
Thanks for all the replies.
Process.Start("mailto:...") seems to be the easiest solution.

Cheers,

John
"John Lafrowda" <la*****@laa.com> schrieb im Newsbeitrag
news:bv**********@news.uni-stuttgart.de...
Hello experts,

I'm coding a routine which should open a new mail form of the mail standard mail client installed on a system (e.g. outlook, outlook express, netscape
mail, etc.) for support reasons. The routine should fill in some textual
information. It should, however, not mail the information directly. The user should be able to check the contents of the mail and he should be able to
edit the mail before sending it.
Consequently, I have the simple question: Is there any method in visual
basic (.net) to force the standard mail client of a machine to open a new
form (like mailto:... in HTML) and fill in some information?

Best regards,

John

Nov 20 '05 #9

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.UseShellExecute = False

psi.FileName = "mailto:" & HttpUtility.UrlEncode([To]) & _
"?subject=" & HttpUtility.UrlEncode(Subject) & _
"&body=" & HttpUtility.UrlEncode(Message)

Process.Start(psi)

'-------------------------
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Sub

i'm using this function,and it works! my question is:
is it possible to get more information from the outlook template, like
the mail server?
very important!
thank you

--
gmarques
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message348338.html

Nov 21 '05 #10

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

Similar topics

1
by: John Altland | last post by:
Here is my basic problem. I have a form that executes a cpu instensive algorithm occupying the first thread. When the algorithm is executed another form pops up telling the user the progress that...
13
by: Peter Amberg | last post by:
I would like to create a link on my page that opens the standard e-mail application when someone clicks it. It should have at least the subject preset, better if I could preset the body as well. I...
21
by: news.btinternnet.com | last post by:
I can do this in IE myLink.click(); //Invoking the handler as if the user had clicked on the link themselves. I need to be able to do the same in Netscape Navigator, can anyone help ?
14
by: stic | last post by:
Hi, I'm in a middle of writing something like 'exception handler wraper' for a set of different methodes. The case is that I have ca. 40 methods form web servicem, with different return values...
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...
7
by: stephan querengaesser | last post by:
hi ng, i try to invoke a webservice-method with an filter-object, that contains value types. if i don´t want to filter the return value of the method, i have to pass a new instance of the...
6
by: Bernhard Straub | last post by:
Hi, using vb .NET 2003 I am trying to open the standard mail client. The mail window should open and the user should be able to choose the recipient, add some text to the mail etc. Using...
6
by: Bob Kline | last post by:
We have run into a problem trying to build a client which works with a web service implemented against the WSDL at . We have successfully created clients using other tools than the DotNet...
14
by: luc.saffre | last post by:
Hello, the simplest way to launch the user's standard mail client from a Python program is by creating a mailto: URL and launching the webbrowser: def...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.