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

  • Thread starter Thread starter jand187
  • Start date Start date
J

jand187

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,

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
 
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.
 
Hi Jan

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

Good Luck,
Jan
 
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 (e-mail address removed)?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.
 
Hi Jan,

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

Good Luck,
Jan
 
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?
 
...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.
 
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
 
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top