473,774 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2096
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**********@g mail.com> escribió en el mensaje
news:Ou******** ******@TK2MSFTN GP04.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.Diagnost ic
Process.Start ("mailto:" + HttpUtility.Url Encode("No***** *******@planet. nl")
+ "?subject=D oes this helps" + "&body=How do you do?");
///

Cor

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAM sogecable.com> schreef in
bericht news:eA******** ******@TK2MSFTN GP05.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**********@g mail.com> escribió en el mensaje
news:Ou******** ******@TK2MSFTN GP04.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.Diagnost ic
Process.Start ("mailto:" + HttpUtility.Url Encode("No***** *******@planet. nl")
+ "?subject=D oes this helps" + "&body=How do you do?");
///

Cor

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAM sogecable.com> schreef in
bericht news:eA******** ******@TK2MSFTN GP05.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**********@g mail.com> escribió en el mensaje
news:Ou******** ******@TK2MSFTN GP04.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******** ******@TK2MSFTN GP02.phx.gbl...
Carlos,

That is systemwebmail. A default client is opened in this way.
\\\
///a reference to System.Web
///using System.Web;
///using System.Diagnost ic
Process.Start ("mailto:" +
HttpUtility.Url Encode("No***** *******@planet. nl")
+ "?subject=D oes 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.Ge tFiles(Me.TempO utputPath)

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.Lengt h - 1
.AttachmentInde x = i
.AttachmentPath Name = FilePaths(i)
Next
.Send(True)
End With
Me.MapiSession. SignOff()
Catch ex As Exception
MsgBox("Error sending MAPI email: " & ex.Message,
MsgBoxStyle.Exc lamation, 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.Ge tFiles(Me.TempO utputPath)

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.Lengt h - 1
.AttachmentInde x = i
.AttachmentPath Name = FilePaths(i)
Next
.Send(True)
End With
Me.MapiSession. SignOff()
Catch ex As Exception
MsgBox("Error sending MAPI email: " & ex.Message,
MsgBoxStyle.Exc lamation, 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**********@g mail.com> escribió en el mensaje
news:OF******** ******@TK2MSFTN GP05.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.Ge tFiles(Me.TempO utputPath)

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.Lengt h - 1
.AttachmentInde x = i
.AttachmentPath Name = FilePaths(i)
Next
.Send(True)
End With
Me.MapiSession. SignOff()
Catch ex As Exception
MsgBox("Error sending MAPI email: " & ex.Message,
MsgBoxStyle.Exc lamation, 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

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

Similar topics

5
7386
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 Run-time error. When I run it on an XP machine it crashes, but on an NT box it just generates an unknown error, handled by the error handler. I have debugged and stepped through the code and have narrowed the issue to the point at which the...
3
3512
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 user's default mail client and start a new email). How would I do that in a Windows C# application? It must be compatible with Outlook 97-2003. Thanks a lot!
3
3039
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 App_Start handler to see if I could get emailed at all even from the first request of the app, but to no avail. Could someone please help me out? Thanks a lot! --Thiago Web developer AgniTEK
4
1653
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 currently for our client/server apps.
0
1075
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 one, it could be 20! I have written the code to attach any number of PDF files to the
3
1335
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 Yahoo account instead of starting the users default email client. Thanks for any help Jason
2
2241
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 smart? what would be a reasonable number? My second question is related to emailing customers who have an anniversary or a Birthday. Is it possible to personalize each email with a name? TIA Tim
2
1468
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 image, if you will, of the entire form. I have a form that my users will fill out and which contains labels as well as text fields. I have the program configured to email me and that part is working. I now need to figure out how to get the program...
8
4195
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 MailMerge for snailMail.
0
9621
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10267
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
10106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8939
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
7463
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
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
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
3
2852
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.