471,599 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 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 3261
<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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Sven Templin | last post: by
3 posts views Thread by Chuck Farah | last post: by
13 posts views Thread by joe215 | last post: by
1 post views Thread by Devonish | last post: by
17 posts views Thread by Bonj | last post: by
4 posts views Thread by JJ | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

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.