Emailing in VB.NET

  • Thread starter Thread starter Michael Turner
  • Start date Start date
M

Michael Turner

Hi

I need to be able to open the users default mail client and insert an
attachment and the recipients email address automaticly I have come across
the following code and wish to know the following.

1. Will it work on all operating systems, if not which ones will it have a
problem with
2. Is it the best way of doing it.

Dim MsgBuilder As New System.Text.StringBuilder
MsgBuilder.Append("<A
href="mailto:[email protected]">mailto:[email protected]</A>")
MsgBuilder.Append("<A
href="mailto:&[email protected],[email protected]">&[email protected]
,[email protected]</A>")
MsgBuilder.Append("<A
href="mailto:&[email protected],[email protected]">&bcc=testcc@testbc
c.com,[email protected]</A>")
MsgBuilder.Append("&subject=this is test subject")
MsgBuilder.Append("&body=this is test body")
MsgBuilder.Append("&Attach="c:\mailattach.txt")
'Debug.WriteLine(MsgBuilder.ToString)
ExecuteFile(MsgBuilder.ToString)
 
Michael Turner said:
I need to be able to open the users default mail client and insert an
attachment and the recipients email address automaticly I have come across
the following code and wish to know the following.

1. Will it work on all operating systems, if not which ones
will it have a problem with

Most mail clients won't accept the '&attach' parameter.

The URL needs to be URLencoded:

Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>
 

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

Back
Top