Click here to Skip to main content
15,502,221 members
Home / Discussions / C#
   

C#

 
Generale-mail files Pin
Kenneth_i27-Jan-04 0:06
Kenneth_i27-Jan-04 0:06 
GeneralRe: e-mail files Pin
Dmitriy Kostovetskiy27-Jan-04 1:30
Dmitriy Kostovetskiy27-Jan-04 1:30 
GeneralRe: e-mail files Pin
JonathanSlenders27-Jan-04 1:42
sussJonathanSlenders27-Jan-04 1:42 
GeneralRe: e-mail files Pin
Mazdak27-Jan-04 2:54
Mazdak27-Jan-04 2:54 
GeneralRe: e-mail files Pin
Kenneth_i27-Jan-04 3:09
Kenneth_i27-Jan-04 3:09 
GeneralRe: e-mail files Pin
Kenneth_i27-Jan-04 3:07
Kenneth_i27-Jan-04 3:07 
GeneralRe: e-mail files Pin
Kenneth_i27-Jan-04 3:05
Kenneth_i27-Jan-04 3:05 
GeneralRe: e-mail files Pin
Heath Stewart27-Jan-04 5:04
protectorHeath Stewart27-Jan-04 5:04 
You can do it either way using the following:
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;

public class Send
{
  private static void Main(string[] args)
  {
    if (args.Length != 1) return;

    ProcessStartInfo psi = new ProcessStartInfo();
    psi.UseShellExecute = true;
    psi.FileName = string.Concat("mailto:?file=", Path.Combine(
      Environment.CurrentDirectory,
      args[0]));
    psi.FileName = psi.FileName.Replace(" ", "%20"); // Simple, not comp.
    Console.WriteLine("Executing '{0}'...", psi.FileName);
 
    Process.Start(psi);
    // OR Process.Start(psi.FileName);
  }
}
The problem with this method is that not every client (like Outlook) support the file segment in a URL this way.

If you want to do this the right way, you'll have to use MAPI which most major email readers support (in order to be a default mail reader, they have to). There are several articles on this on CodeProject. Just try this search: http://www.codeproject.com/info/search.asp?cats=3&cats=5&searchkw=MAPI[^].

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: e-mail files Pin
Kenneth_i27-Jan-04 15:08
Kenneth_i27-Jan-04 15:08 
GeneralClass Inheritance Pin
Gareth_Hastings26-Jan-04 23:49
Gareth_Hastings26-Jan-04 23:49 
GeneralRe: Class Inheritance Pin
Dmitriy Kostovetskiy27-Jan-04 0:28
Dmitriy Kostovetskiy27-Jan-04 0:28 
GeneralRe: Class Inheritance Pin
Nick Parker27-Jan-04 8:05
protectorNick Parker27-Jan-04 8:05 
GeneralSelect node in a TreeView Pin
thomasa26-Jan-04 23:31
thomasa26-Jan-04 23:31 
GeneralRe: Select node in a TreeView Pin
Heath Stewart27-Jan-04 4:40
protectorHeath Stewart27-Jan-04 4:40 
GeneralRe: Select node in a TreeView Pin
Uwe Keim28-Jan-04 4:09
sitebuilderUwe Keim28-Jan-04 4:09 
GeneralRe: Select node in a TreeView Pin
Heath Stewart28-Jan-04 6:38
protectorHeath Stewart28-Jan-04 6:38 
GeneralRe: Select node in a TreeView Pin
Uwe Keim28-Jan-04 6:46
sitebuilderUwe Keim28-Jan-04 6:46 
QuestionHow to disable a control in MDI form from a child form Pin
okoji Cyril26-Jan-04 21:56
okoji Cyril26-Jan-04 21:56 
AnswerRe: How to disable a control in MDI form from a child form Pin
Heath Stewart27-Jan-04 4:19
protectorHeath Stewart27-Jan-04 4:19 
GeneralC# and Scintilla Pin
yarns26-Jan-04 21:45
yarns26-Jan-04 21:45 
GeneralRe: C# and Scintilla Pin
Uwe Keim28-Jan-04 4:06
sitebuilderUwe Keim28-Jan-04 4:06 
GeneralRe: C# and Scintilla Pin
wonea25-Feb-10 2:49
wonea25-Feb-10 2:49 
QuestionReal-world commercial .NET Applications? Any? Pin
Uwe Keim26-Jan-04 19:13
sitebuilderUwe Keim26-Jan-04 19:13 
AnswerRe: Real-world commercial .NET Applications? Any? Pin
Mazdak26-Jan-04 20:27
Mazdak26-Jan-04 20:27 
GeneralRe: Real-world commercial .NET Applications? Any? Pin
Uwe Keim26-Jan-04 23:12
sitebuilderUwe Keim26-Jan-04 23:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.