473,379 Members | 1,187 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,379 software developers and data experts.

Opening a new email in Outlook from a windows form (Without sending the email).

Hi,

I need to open an email in outlook (exchange) with most of the fields
filled out and a file attached. I don't want to send the mail right
away as the user must be able to edit the body text.

How can I accomplish this from a Windows Form written in C# ?

I know about the System.Web.Mail stuff, but that can only send the
email. I've also tried using the System.Diagnostics.Start("mailto:")
method, but that doesn't allow for attaching files.

Please help! :)

Regards
Jan Daniel Andersen

Nov 17 '05 #1
10 3349
<ja*****@gmail.com> schrieb im Newsbeitrag
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi,

I need to open an email in outlook (exchange) with most of the fields
filled out and a file attached. I don't want to send the mail right
away as the user must be able to edit the body text.

How can I accomplish this from a Windows Form written in C# ?

I know about the System.Web.Mail stuff, but that can only send the
email. I've also tried using the System.Diagnostics.Start("mailto:")
method, but that doesn't allow for attaching files.

Please help! :)

Regards
Jan Daniel Andersen


Hi Jan
you could make it like this:
System.Diagnostics.Process.Start("mailto:" + mailTo + "?subject=" + subject
+ "&body="
+ body);

But get sure, the injected parts are well decoded: '%' -> '%25'; & -> '%26';
'?' -> '%3F'; '\' -> '%22' newLine -> '%0D%0A'

Hope that helps
Christof
Nov 17 '05 #2
I know about the Mailto stuff. But that cannot attach files. I need to
get the email opened in outlook without sending it but WITH a file
attached to it.

Nov 17 '05 #3
Since the attachment is an important part of your requirements, you will
probably need to use Outlook Automation. However, you will need to work
through several issues to get this to work well, chief among them is
security. For information on automating Outlook through C#, see
http://msdn.microsoft.com/office/und...d/default.aspx
<ja*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi,

I need to open an email in outlook (exchange) with most of the fields
filled out and a file attached. I don't want to send the mail right
away as the user must be able to edit the body text.

How can I accomplish this from a Windows Form written in C# ?

I know about the System.Web.Mail stuff, but that can only send the
email. I've also tried using the System.Diagnostics.Start("mailto:")
method, but that doesn't allow for attaching files.

Please help! :)

Regards
Jan Daniel Andersen

Nov 17 '05 #4
Hi Jan

Looks like you need to acces the Exchange Store using POP3. QuikSoft
amoung other offer libraries..

Good Luck,
Jan

Nov 17 '05 #5
Hi,

Thank you for your reply. I will look into this QuikSoft thing.

In the meantime I would like to check if anyone have experience using
Outlook command line switches.

It's possible to use:
...\outlook.exe -c ipm.note -m em***@email.org?Subject=X&Body=Y

This opens outlook and creates a new email with the "To" and "Subject"
fields filled out. The body doesn't seem to work, but it gives an error
if you omit it.

also:

...\outlook.exe -a "c:\temp\file.txt"

This opens outlook and creates a new email with the file specified as
an attachment.

The really wierd thing here is that you cannot use switches -c and -m
toghether with switch -a. Anyone have any experience with this.

Nov 17 '05 #6
Hi Jan,

If you *must* use outlook try using "Outlook Redeption" and MAPI.

Good Luck,
Jan

Nov 17 '05 #7
> If you *must* use outlook try using "Outlook Redeption" and MAPI.

....what if one just wants to use the default email client, be it
Outlook, Outlook Express, or Thunderbird/Mozilla?
Nov 17 '05 #8
On Wed, 14 Sep 2005 16:21:51 -0700, Evan Stone
<re*********************@hotmail.com> wrote:
If you *must* use outlook try using "Outlook Redeption" and MAPI.


...what if one just wants to use the default email client, be it
Outlook, Outlook Express, or Thunderbird/Mozilla?


Then you have to use MAPI, which means you have to use P/Invoke since
..NET still doesn't support MAPI.
--
http://www.kynosarges.de
Nov 17 '05 #9
Thanks for the information and the suggestion, Christopher.

I'm not really familiar with using P/Invoke in .NET (I'm still relatively
new to the platform), but I'll do some research on the subject and hopefully
can get this going...

Thanks!

evan stone | software engineer
----------------------------------------
santa rosa, ca, usa
"Christoph Nahr" <ch************@kynosarges.de> wrote in message
news:se********************************@4ax.com...
On Wed, 14 Sep 2005 16:21:51 -0700, Evan Stone
<re*********************@hotmail.com> wrote:
If you *must* use outlook try using "Outlook Redeption" and MAPI.


...what if one just wants to use the default email client, be it
Outlook, Outlook Express, or Thunderbird/Mozilla?


Then you have to use MAPI, which means you have to use P/Invoke since
.NET still doesn't support MAPI.
--
http://www.kynosarges.de

Nov 17 '05 #10
You might want to have a look at my little multipurpose library:
http://www.kynosarges.de/Tektosyne.html

The namespace Tektosyne.WebMail contains a few wrapper methods for
Simple MAPI functions, and the namespace Tektosyne.Win32Api contains
the necessary P/Invoke declarations. That should get you started.
Good luck!

On Thu, 15 Sep 2005 11:49:47 -0700, "Evan Stone"
<re*********************@hotmail.com> wrote:
Thanks for the information and the suggestion, Christopher.

I'm not really familiar with using P/Invoke in .NET (I'm still relatively
new to the platform), but I'll do some research on the subject and hopefully
can get this going...

Thanks!

evan stone | software engineer
----------------------------------------
santa rosa, ca, usa

--
http://www.kynosarges.de
Nov 17 '05 #11

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

Similar topics

15
by: Sven Templin | last post by:
Hello all, our configuration is as following described: - OS: Windows 2000 - Apache server 1.3 - Php 3.8 - MS outlook client 2000 _and_ no SMTP server available in the whole intranet.
3
by: Chuck Farah | last post by:
I am unsuccessfullly trying to display an outlook email from a vb web forms (.net) outlook 2002 #1. is it possible to use outlook client email from a web form using the outlook object model...
13
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using...
1
by: Devonish | last post by:
I am composing an email with Access VB and then sending it from within Access. Everything works correctly (the email actually goes!) but Outlook ask some irritating questions that the user is...
17
by: Bonj | last post by:
Right guys. (I would like a solution to this in VB6 as this is what our needy app is written in, but any solutions that involve .NET would be much appreciated likewise as I could instantiate...
7
by: mg | last post by:
I need to first open WebForm2 from WebForm1 and then close WebForm1 without the end user having to press an OK button before the close can occur. For example, possibly ...
4
by: JJ | last post by:
Whats the most compatilbe way of sending an email ?- I need to consider that the OS may be win 98/win NT/Win 2000/winXP. I was constructing a mailto command, but the contents of the text file I...
3
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.