473,406 Members | 2,710 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,406 software developers and data experts.

Emailing with default client

(using VB.NET 2005)

I'm writing a desktop application that I would like to have the ability
to email files. I've set up the SMTP portion, now I would like to have a
MAPI option.

I found a MAPI tutorial, but it does a bit more than I want it to. What
I would like to do is this:

1. Open the default mail client's compose window.
2. Add an attachment

Then the user can fill out the To: Subject: etc.

Can anyone help me with this?

Thanks,
Dustin
Apr 18 '06 #1
11 2066
Dustin,

Your problem is in this sentence
2. Add an attachment


Not all emailclients have the possiblitity to add attachments. It is as well
not in the standard code for opening default email clients.

This question is thousand times done in this newsgroup. If you know that it
is Office Outlook than there are possibilites and I have read from Carlos
that it can as well at OutlookExpress, but not right from the box.

Cor
Apr 19 '06 #2
Hi Dustin,

See if there is something here:

How do I send an email with attachments?
http://systemwebmail.com/faq/2.3.aspx

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

"Dustin Davis" <du**********@gmail.com> escribió en el mensaje
news:Ou**************@TK2MSFTNGP04.phx.gbl...
(using VB.NET 2005)

I'm writing a desktop application that I would like to have the ability to
email files. I've set up the SMTP portion, now I would like to have a MAPI
option.

I found a MAPI tutorial, but it does a bit more than I want it to. What I
would like to do is this:

1. Open the default mail client's compose window.
2. Add an attachment

Then the user can fill out the To: Subject: etc.

Can anyone help me with this?

Thanks,
Dustin

Apr 19 '06 #3
Carlos,

That is systemwebmail. A default client is opened in this way.
\\\
///a reference to System.Web
///using System.Web;
///using System.Diagnostic
Process.Start ("mailto:" + HttpUtility.UrlEncode("No************@planet.nl")
+ "?subject=Does this helps" + "&body=How do you do?");
///

Cor

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> schreef in
bericht news:eA**************@TK2MSFTNGP05.phx.gbl...
Hi Dustin,

See if there is something here:

How do I send an email with attachments?
http://systemwebmail.com/faq/2.3.aspx

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

"Dustin Davis" <du**********@gmail.com> escribió en el mensaje
news:Ou**************@TK2MSFTNGP04.phx.gbl...
(using VB.NET 2005)

I'm writing a desktop application that I would like to have the ability
to email files. I've set up the SMTP portion, now I would like to have a
MAPI option.

I found a MAPI tutorial, but it does a bit more than I want it to. What I
would like to do is this:

1. Open the default mail client's compose window.
2. Add an attachment

Then the user can fill out the To: Subject: etc.

Can anyone help me with this?

Thanks,
Dustin


Apr 19 '06 #4
I've tried the mailto: method, but I can't seem to add an attachment.
I'm watching another program do the very thing I am trying to do, but I
don't know how it is doing it. It opens the default mail client compose
window with the specified file attached. Amazingly it works when I have
either Outlook Express or Thuderbird as my default mail client.

I've tried using the VB6 MAPI controls (MAPISession & MAPIMessages), I
can sent through Outlook Express, but not Thunderbird. When I send
through Outlook express it makes me enter my password twice - the fist
time is when it connects (it then wants to download all my new
messages), then again when I got to send. Frustrating :(

Cor Ligthert [MVP] wrote:
Carlos,

That is systemwebmail. A default client is opened in this way.
\\\
///a reference to System.Web
///using System.Web;
///using System.Diagnostic
Process.Start ("mailto:" + HttpUtility.UrlEncode("No************@planet.nl")
+ "?subject=Does this helps" + "&body=How do you do?");
///

Cor

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> schreef in
bericht news:eA**************@TK2MSFTNGP05.phx.gbl...
Hi Dustin,

See if there is something here:

How do I send an email with attachments?
http://systemwebmail.com/faq/2.3.aspx

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

"Dustin Davis" <du**********@gmail.com> escribió en el mensaje
news:Ou**************@TK2MSFTNGP04.phx.gbl...
(using VB.NET 2005)

I'm writing a desktop application that I would like to have the ability
to email files. I've set up the SMTP portion, now I would like to have a
MAPI option.

I found a MAPI tutorial, but it does a bit more than I want it to. What I
would like to do is this:

1. Open the default mail client's compose window.
2. Add an attachment

Then the user can fill out the To: Subject: etc.

Can anyone help me with this?

Thanks,
Dustin


Apr 19 '06 #5
Ah, yes, but anyway an approach would be to use SystemWebMail and provide
your own compose form with subject, destination textboxes and attach button
since I don´t think that Simple MAPI will be able to add attachments, so
either you need to use Extended MAPI (C++), not .NET compatible, or use CDO,
which may not work for all e-mail clients.

See:

Differences between CDO, Simple MAPI, and Extended MAPI
http://support.microsoft.com/kb/200018/en-us
--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
"Cor Ligthert [MVP]" <no************@planet.nl> escribió en el mensaje
news:eE**************@TK2MSFTNGP02.phx.gbl...
Carlos,

That is systemwebmail. A default client is opened in this way.
\\\
///a reference to System.Web
///using System.Web;
///using System.Diagnostic
Process.Start ("mailto:" +
HttpUtility.UrlEncode("No************@planet.nl")
+ "?subject=Does this helps" + "&body=How do you do?");
///


Apr 19 '06 #6
So, in any case, I got it to work as I needed using the VB6 MAPI
controls. Without going into too much detail, I'll just post the
function here in case anyone else is interested. Let me know if you have
question on what I did here (This works in Mozilla Thunderbird and
Outlook Express):

Private Function SendMapiEmail() As Boolean
Dim FilePaths() As String = IO.Directory.GetFiles(Me.TempOutputPath)

Try
With Me.MapiSession
If .SessionID = 0 Then
.DownLoadMail = False
.LogonUI = True
.SignOn()
End If
End With

With Me.MapiMessages
.SessionID = Me.MapiSession.SessionID
.Compose()
.MsgSubject = "Images Attached"
.MsgNoteText = "(See Attached)"
For i As Integer = 0 To FilePaths.Length - 1
.AttachmentIndex = i
.AttachmentPathName = FilePaths(i)
Next
.Send(True)
End With
Me.MapiSession.SignOff()
Catch ex As Exception
MsgBox("Error sending MAPI email: " & ex.Message,
MsgBoxStyle.Exclamation, AppName)
Return False
End Try

Return True
End Function

Carlos J. Quintero [VB MVP] wrote:
Ah, yes, but anyway an approach would be to use SystemWebMail and provide
your own compose form with subject, destination textboxes and attach button
since I don´t think that Simple MAPI will be able to add attachments, so
either you need to use Extended MAPI (C++), not .NET compatible, or use CDO,
which may not work for all e-mail clients.

See:

Differences between CDO, Simple MAPI, and Extended MAPI
http://support.microsoft.com/kb/200018/en-us

Apr 19 '06 #7
What .dll did you have to reference to use VB6Mapi?
--
Dennis in Houston
"Dustin Davis" wrote:
So, in any case, I got it to work as I needed using the VB6 MAPI
controls. Without going into too much detail, I'll just post the
function here in case anyone else is interested. Let me know if you have
question on what I did here (This works in Mozilla Thunderbird and
Outlook Express):

Private Function SendMapiEmail() As Boolean
Dim FilePaths() As String = IO.Directory.GetFiles(Me.TempOutputPath)

Try
With Me.MapiSession
If .SessionID = 0 Then
.DownLoadMail = False
.LogonUI = True
.SignOn()
End If
End With

With Me.MapiMessages
.SessionID = Me.MapiSession.SessionID
.Compose()
.MsgSubject = "Images Attached"
.MsgNoteText = "(See Attached)"
For i As Integer = 0 To FilePaths.Length - 1
.AttachmentIndex = i
.AttachmentPathName = FilePaths(i)
Next
.Send(True)
End With
Me.MapiSession.SignOff()
Catch ex As Exception
MsgBox("Error sending MAPI email: " & ex.Message,
MsgBoxStyle.Exclamation, AppName)
Return False
End Try

Return True
End Function

Carlos J. Quintero [VB MVP] wrote:
Ah, yes, but anyway an approach would be to use SystemWebMail and provide
your own compose form with subject, destination textboxes and attach button
since I don´t think that Simple MAPI will be able to add attachments, so
either you need to use Extended MAPI (C++), not .NET compatible, or use CDO,
which may not work for all e-mail clients.

See:

Differences between CDO, Simple MAPI, and Extended MAPI
http://support.microsoft.com/kb/200018/en-us

Apr 19 '06 #8
So the MAPI controls allow to send attachments. Did you investigate of the
Simple MAPI allow that? They are 12 API functions or so and if it works it
would allow you to get rid of the VB6 controls in your app...

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com


"Dustin Davis" <du**********@gmail.com> escribió en el mensaje
news:OF**************@TK2MSFTNGP05.phx.gbl...
So, in any case, I got it to work as I needed using the VB6 MAPI controls.
Without going into too much detail, I'll just post the function here in
case anyone else is interested. Let me know if you have question on what I
did here (This works in Mozilla Thunderbird and Outlook Express):

Private Function SendMapiEmail() As Boolean
Dim FilePaths() As String = IO.Directory.GetFiles(Me.TempOutputPath)

Try
With Me.MapiSession
If .SessionID = 0 Then
.DownLoadMail = False
.LogonUI = True
.SignOn()
End If
End With

With Me.MapiMessages
.SessionID = Me.MapiSession.SessionID
.Compose()
.MsgSubject = "Images Attached"
.MsgNoteText = "(See Attached)"
For i As Integer = 0 To FilePaths.Length - 1
.AttachmentIndex = i
.AttachmentPathName = FilePaths(i)
Next
.Send(True)
End With
Me.MapiSession.SignOff()
Catch ex As Exception
MsgBox("Error sending MAPI email: " & ex.Message,
MsgBoxStyle.Exclamation, AppName)
Return False
End Try

Return True
End Function


Apr 20 '06 #9
Here's the steps you should follow to get the code to work that I posted
previously:

1. Add a reference to the COM "Microsoft MAPI Controls 6.0"
2. In your Toolbox, right-click and select "Choose items..."
3. In the COM Components tab, select the "Microsoft MAPI Messages
Control" and the "Microsoft MAPI Session Control"
4. Add the controls to your form

Dennis wrote:
What .dll did you have to reference to use VB6Mapi?

Apr 20 '06 #10
I don't have VB6 installed on my computer and don't want to install it
really. Can I get the controls and just add them to the bin directory? If
so, where can I find them>
--
Dennis in Houston
"Dustin Davis" wrote:
Here's the steps you should follow to get the code to work that I posted
previously:

1. Add a reference to the COM "Microsoft MAPI Controls 6.0"
2. In your Toolbox, right-click and select "Choose items..."
3. In the COM Components tab, select the "Microsoft MAPI Messages
Control" and the "Microsoft MAPI Session Control"
4. Add the controls to your form

Dennis wrote:
What .dll did you have to reference to use VB6Mapi?

Apr 20 '06 #11
I'm not sure. I don't have vb6 installed either. VB.NET 2005 is the only
version I have ever installed on my machine.

Dennis wrote:
I don't have VB6 installed on my computer and don't want to install it
really. Can I get the controls and just add them to the bin directory? If
so, where can I find them>

Apr 21 '06 #12

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

Similar topics

5
by: Colin Anderson | last post by:
I discovered, with great excitement, this article http://www.davison.uk.net/vb2notes.asp when researching methods for emailing from Access via Notes. Unfortunatly, when I run this I get a...
3
by: John Smith | last post by:
Hey folks, I've got a C# Windows application that needs the ability to send emails. It should behave the same way as when you click on a mailto link through a web browser (i.e. open up the...
3
by: tafs7 | last post by:
My code below is supposed to email me when an error occurs on the application, but it's not emailing anything. Am I missing something? I know the smtp servers I've tried work. I even added a...
4
by: Mike Moore | last post by:
What is the best way to launch outlook from an asp.net web page? Can you do this using MAPI or is there a control that you can purchase? We are unable to use SMTP. We use MS Exhange and MAPI...
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...
3
by: Jase | last post by:
Hi, Not sure whether this is possible but what i want is to add an "Send To A Friend" button, but i want the button to send an email to an address (Specified by user) from my personal Hotmail or...
2
by: Tim Hunter | last post by:
I have two questions regarding emailing from Access. My first question relates to how many email addresses is too much. I have a client who wants to email 1500 people at once. Is this possible or...
2
by: =?Utf-8?B?S3J5c3RhbCBWQiBOZXdiaWU=?= | last post by:
I am brand new to programming and was hoping that someone could tell me how to take the next step in my windows application. I need to be able to email not just the contents of a form but an...
8
by: marjbell | last post by:
I have a Access database of email addresses that I would like to mass email to customers. Can Access be used through Outlook? or can it just be done with Access? I know it is possible to use...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.