473,800 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1698
You can use shellexecute api call and pass mailto:yo****** ***@xyz.com in the
lpfile paramater.

Vikram
"John Lafrowda" <la*****@laa.co m> 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.Http Utility

Public Sub StartDefaultMai l (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.Http Utility

Public Sub StartDefaultMai l (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.co m> 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 StartDefaultMai l(ByVal [To] As String, Optional ByVal Subject
As String = "", Optional ByVal Message As String = "")
Try
Dim psi As New ProcessStartInf o

psi.UseShellExe cute = True
'psi.UseShellEx ecute = False

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

Process.Start(p si)

'-------------------------
Catch ex As Exception
Throw New Exception(ex.Me ssage, 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
4107
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 has been made. Whenever I attempt to update my frmProgress, the events are put placed at the end of the thread's queue and executed after my algorithm is finished. Using the frmProgress.Label.Invoke method with delagates, I have heard would fix...
13
4494
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 read somewhere that the TITLE attribute of the A HREF tag can be used to set a subject, so I tried: <A HREF="mailto:" TITLE="MySubject"> This would open the e-mail application, but the TITLE attribute is completely ignored, at least on...
21
6592
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
7355
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 (and types), and with out parmeters. What I want to do is to support each method call with exception (http 404, soap exception, and other types of exceptions) and wrap it with try & catch (a lots of catch ;-)
6
3083
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 the code to invoke whatever email client the users has as the default. Any pointers to some information on how to do this would be appreciated. Wayne
7
5406
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 filter-object without setting any properties. but the value type-properties can´t be null and the filter is set to 0 (int) or false (bool). therefore i did implement the propertySpecified-pattern like this:
6
2851
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 Process.Start with "mailto" doesn't help as I want to add attachments already in the code. I don't want to use the Outlook reference as the user may not have Outlook installed on the system. I found that something called Simple MAPI may be used but I...
6
13614
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 framework, and in fact we were able to create a client using an earlier version of the framework (1.1.4322.2032) without any problems. With the current version of the framework (2.0.50727.42) it appears that the Invoke method of the...
14
4851
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 mailto_url(to=None,subject=None,body=None,cc=None): """ encodes the content as a mailto link as described on http://www.faqs.org/rfcs/rfc2368.html
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9090
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7580
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.