Sending an e-mail, how

B

Bob Dufour

E-Mail address is shown in a textbox on a windows form. Can anyone point me
to code that would allow the standard e-mail client of the user to pop up on
double-click and have the address filled in?

Is there a controol that alrerady has this behaviour built -in?

Thanks for any information,

Bob
 
C

Chad Z. Hower aka Kudzu

Bob Dufour said:
E-Mail address is shown in a textbox on a windows form. Can anyone point
me to code that would allow the standard e-mail client of the user to
pop up on double-click and have the address filled in?

Is there a controol that alrerady has this behaviour built -in?

Just launch the URL "mailto:[email protected]" and the default mail client will
pop up.

You need to use the .net equivalent of ShellExecute to launch it.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"


ELKNews - Get your free copy at http://www.atozedsoftware.com
 
S

Stephen Jebaraj

Hi Bob,

This code launches the default email client and creates a new message. The
subject field is filled with the email address on the textbox.

System.Diagnostics.Process.Start("mailto:" + textBox1.Text);

Regards,

Stephen Jebaraj
Syncfusion Inc
visit http://www.syncfusion.com for .NET Essentials
 
C

Cor

Hi Herfried,

This sample contains a little error (The subject and the message is also
urlencoded).

I changed it

Cor

\\\by Fergus Cooney & small correction 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
///

<http://groups.google.com/[email protected]
l>
 
C

Cor

Hi Bob,

A little change in the sample link you got from Herfried,

I hope this helps?

Cor

\\\by Fergus Cooney & small correction 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
///
 
H

Herfried K. Wagner [MVP]

* "Cor said:
This sample contains a little error (The subject and the message is also
urlencoded).

I remember subject and message must be encoded too because otherwise
there may be problems when calling 'Process.Start'.
 
C

Cor

Hi Herfried,

Did you try it, otherwise give me a link, than I will check it and see what
to do about it, now it not to read.

(I did try it of course as you know but not on every OS)

Cor
 
H

Herfried K. Wagner [MVP]

* "Cor said:
Did you try it, otherwise give me a link, than I will check it and see what
to do about it, now it not to read.

Sorry, I don't have an example, but I am not sure if the OS treats the
whole stings as URL. If it does so, everything will have to be encoded.
 
C

Cor

Hi Herfried,

I tested it again I see nothing strange, but now I discovered that I can use
it maybe for news also, so I did not send it here as a complete module till
I am ready with that.

However I have to find the Urlstring for a news.
It is something as @newsserver and then a lot, if you know it, or
see it let me know?

OK?

Cor
 
H

Herfried K. Wagner [MVP]

* "Cor said:
I tested it again I see nothing strange, but now I discovered that I can use
it maybe for news also, so I did not send it here as a complete module till
I am ready with that.

However I have to find the Urlstring for a news.
It is something as @newsserver and then a lot, if you know it, or
see it let me know?

Are you talking about the message-id?
 
C

Cor

Hi Chad,

I do not want to reference, that I could see in past everyday hundreds times
when Herfried gives a message to redirect to the aspnet and adonet group

I want to use it in a Javascript, I think I will find it, now I have better
made the problem clear for me, but if you have it, I will be pleased.

The complete URL is something as
I do not say it works, it works with
mailto:\\...............................

But I am curious if I it workst for newsgroups with OE also.

Cor
 
C

Cor

Kudzu,

I have the same idea, but I was trying if it would go,

(Found nothing on internet, I can start OE and opening the right newsgroup
but not direct a message)

But Thanks.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top