Results 1 to 7 of 7

Thread: Outllook and VC#

  1. #1

    Thread Starter
    Hyperactive Member Dorothy's Avatar
    Join Date
    Feb 2001
    Posts
    310

    Question Outllook and VC#

    On Click of a button I need to open an Outlook mail box with an email id in the To and with a specifc message typed in and with a file attached ( specified by the user in a txtbox on a form) ?

  2. #2
    Lively Member
    Join Date
    Sep 2002
    Posts
    100
    =) System.Diagnostics.Process.Start("mailto:[email protected]");

  3. #3

    Thread Starter
    Hyperactive Member Dorothy's Avatar
    Join Date
    Feb 2001
    Posts
    310

    Smile Thanks

    Thanks for that.

    How about attaching files?

  4. #4
    Lively Member
    Join Date
    Sep 2002
    Posts
    100
    Well...if your sending e-mails try the System.Mail class..you have to add a refrence to it. Or make your own mail sender, or you can check Microsoft.com for how to use outlook through a command line..

    -toto

  5. #5

    Thread Starter
    Hyperactive Member Dorothy's Avatar
    Join Date
    Feb 2001
    Posts
    310

    Smile

    Here is the working code:

    Outlook.Application oApp=new Outlook.Application();
    Outlook._NameSpace oNameSpace=oApp.GetNamespace("MAPI");
    oNameSpace.Logon("",null,false,false);
    Outlook._MailItem om = (Outlook._MailItem)
    oApp.CreateItem(Outlook.OlItemType.olMailItem);
    om.Attachments.Add("C:\\ivan.txt",1,1,"Ivan");
    om.To = "[email protected]";
    om.Subject = "VC# is Great";
    om.Body="dfgfdgf";
    om.Display(false);

    Uses Microsoft Outlook lib

    Thanks toto for the help extended.

  6. #6
    Fanatic Member BrianHawley's Avatar
    Join Date
    Aug 2001
    Location
    Saudi Arabia
    Posts
    796
    Thanks! You just saved me a bunch of work.
    Brian
    (Fighting with the RightToLeft bugs in VS 2005)

  7. #7
    Lively Member
    Join Date
    Feb 2002
    Location
    chennai
    Posts
    90
    Hi

    i could not add a reference to outlook.. i added microsoft outlook library 10.0.. but still it underlines during compilation..
    pls help

    thanks
    akalya

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width