Click here to Skip to main content
16,020,669 members
Home / Discussions / C#
   

C#

 
Generale-mail files Pin
Kenneth_i26-Jan-04 23:06
Kenneth_i26-Jan-04 23:06 
GeneralRe: e-mail files Pin
Dmitriy Kostovetskiy27-Jan-04 0:30
Dmitriy Kostovetskiy27-Jan-04 0:30 
GeneralRe: e-mail files Pin
JonathanSlenders27-Jan-04 0:42
sussJonathanSlenders27-Jan-04 0:42 
GeneralRe: e-mail files Pin
Mazdak27-Jan-04 1:54
Mazdak27-Jan-04 1:54 
GeneralRe: e-mail files Pin
Kenneth_i27-Jan-04 2:09
Kenneth_i27-Jan-04 2:09 
GeneralRe: e-mail files Pin
Kenneth_i27-Jan-04 2:07
Kenneth_i27-Jan-04 2:07 
GeneralRe: e-mail files Pin
Kenneth_i27-Jan-04 2:05
Kenneth_i27-Jan-04 2:05 
GeneralRe: e-mail files Pin
Heath Stewart27-Jan-04 4:04
protectorHeath Stewart27-Jan-04 4: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 14:08
Kenneth_i27-Jan-04 14:08 
GeneralClass Inheritance Pin
Gareth_Hastings26-Jan-04 22:49
Gareth_Hastings26-Jan-04 22:49 
GeneralRe: Class Inheritance Pin
Dmitriy Kostovetskiy26-Jan-04 23:28
Dmitriy Kostovetskiy26-Jan-04 23:28 
GeneralRe: Class Inheritance Pin
Nick Parker27-Jan-04 7:05
protectorNick Parker27-Jan-04 7:05 
GeneralSelect node in a TreeView Pin
thomasa26-Jan-04 22:31
thomasa26-Jan-04 22:31 
GeneralRe: Select node in a TreeView Pin
Heath Stewart27-Jan-04 3:40
protectorHeath Stewart27-Jan-04 3:40 
GeneralRe: Select node in a TreeView Pin
Uwe Keim28-Jan-04 3:09
sitebuilderUwe Keim28-Jan-04 3:09 
GeneralRe: Select node in a TreeView Pin
Heath Stewart28-Jan-04 5:38
protectorHeath Stewart28-Jan-04 5:38 
GeneralRe: Select node in a TreeView Pin
Uwe Keim28-Jan-04 5:46
sitebuilderUwe Keim28-Jan-04 5:46 
QuestionHow to disable a control in MDI form from a child form Pin
okoji Cyril26-Jan-04 20:56
okoji Cyril26-Jan-04 20:56 
AnswerRe: How to disable a control in MDI form from a child form Pin
Heath Stewart27-Jan-04 3:19
protectorHeath Stewart27-Jan-04 3:19 
GeneralC# and Scintilla Pin
yarns26-Jan-04 20:45
yarns26-Jan-04 20:45 
GeneralRe: C# and Scintilla Pin
Uwe Keim28-Jan-04 3:06
sitebuilderUwe Keim28-Jan-04 3:06 
GeneralRe: C# and Scintilla Pin
wonea25-Feb-10 1:49
wonea25-Feb-10 1:49 
QuestionReal-world commercial .NET Applications? Any? Pin
Uwe Keim26-Jan-04 18:13
sitebuilderUwe Keim26-Jan-04 18:13 
AnswerRe: Real-world commercial .NET Applications? Any? Pin
Mazdak26-Jan-04 19:27
Mazdak26-Jan-04 19:27 
GeneralRe: Real-world commercial .NET Applications? Any? Pin
Uwe Keim26-Jan-04 22:12
sitebuilderUwe Keim26-Jan-04 22: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.