By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,876 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,876 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
10 Replies


P: n/a
<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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
Hi Jan,

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

Good Luck,
Jan

Nov 17 '05 #7

P: n/a
> 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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.