CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: E-mail

  1. #1
    Join Date
    Aug 1999
    Location
    Canada
    Posts
    2,076

    E-mail

    I need to read all messages in Inbox ( or Sent Items folder )in OUTLOOK. Is anybody who was working on the same problem before?

    I found a lot of examples, but there seems to me very complicated ( EXCHANGE API or VB examples). All I need is open particular folder and read ( and display) messages located in folder ( Inbox or Sent Items). Just simple solution.

    Thanks for your help and I appreciate it.

    Frank


  2. #2
    Join Date
    Apr 2000
    Posts
    370

    Re: E-mail

    Hi Frank,
    You can use CDO(Collaboration Data Objects) to access your messaging services.Internally it uses MAPI to get all the things done. you can have a look at the samples in the following location which does exactly what you want.

    http://support.microsoft.com/support.../Q178/4/80.ASP

    Hope this helped you!
    -Amudhan

    -Amudhan

  3. #3
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266

    Re: E-mail

    If you have Windows 2000 you can use CDOSYS. If you have IIS installed or can install it, then you can use CDONTS. If you want a solution that is guaranteed to work on any Windows system, I think you can use MAPI and I think there are useful samples at:

    http://msdn.microsoft.com/library/de...pi_samples.asp

    CDO is much easier than MAPI but MAPI is older and you can probably assume it will be already available in any (32-bit) system.


    ****************************************************************************************************
    Ratings are unimportant but follow-up is. Try to somehow let the helper and the worldwide community know what works.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  4. #4
    Join Date
    Aug 1999
    Location
    Canada
    Posts
    2,076

    Re: E-mail

    Thanks,
    but I can't find in given example information how to read message. I know how to send message, attach file.... I need only read messages in Inbox folder. Some simple solution.

    Frank


  5. #5
    Join Date
    Apr 2000
    Posts
    370

    Re: E-mail

    Hi, if you want only the list of message it there in the code sample.
    but if you want to read a particular message
    try using the following code sample!
    I haven't tried it. but got form MSDN!


    void Save_Message_to_File(IMessagePtr iMsg, bstr_t filename)
    {
    /*
    ** This example shows a common use of the ADO Stream
    ** object with CDO, namely, saving a serialized
    ** message to disk using an ADO Stream object.
    **/
    _StreamPtr pStm(__uuidof(Stream));
    IDataSourcePtr iDsrc;
    iDsrc = iMsg;

    _variant_t varOptional(DISP_E_PARAMNOTFOUND,VT_ERROR);
    pStm->raw_Open(
    varOptional,
    adModeUnknown,
    adOpenStreamUnspecified,
    NULL,
    NULL);
    pStm->Type = adTypeText;
    pStm->Charset = "US-ASCII"; // apparently, we need this!
    try
    {
    iDsrc->SaveToObject(pStm,_bstr_t("_Stream"));
    }
    catch(_com_error error)
    {
    throw error;
    }

    try {
    pStm->SaveToFile(filename,adSaveCreateOverWrite);
    }
    catch(_com_error e)
    {
    throw e;
    }
    }



    Hope this helps!

    -Amudhan

  6. #6
    Join Date
    Aug 1999
    Location
    Canada
    Posts
    2,076

    Re: E-mail

    Thanks a lot for your help.


  7. #7
    Join Date
    Aug 2001
    Posts
    260
    Hi Amudhan G,
    I run your example code and it 's OK on Windows 2000
    but it cannot be run on WINNT 4
    Please give me another example if you can.
    or give me any ideas.
    thank you.

  8. #8
    Join Date
    Aug 2001
    Posts
    260
    hi
    http://msdn.microsoft.com/library/d...api_samples.asp
    I tried to find examples but I cannot
    ....
    please tell me where
    thks

  9. #9
    Join Date
    Jul 1999
    Location
    San Jose,CA
    Posts
    246

    All i need to do is send messages!

    This what I need to do...

    Take the email address form the list of contacts(In MS Outlook),
    send it an email message,in the email message the text will be same for all the emails,
    Only at the top i should have

    Dear $$$$$
    where $$$$ is the name that I get from the contact,
    so it would be like

    Dear Xeon

    (email message)


    Dear Sam
    (email message)

    Dear Codeguru
    (email message)
    and so on and so forth till I have sent an email to all the contacts in the contact list.
    I have to add an attachment file as well but it will be the same for all the contacts

    Also I will need to set the subject too I guess through the program...
    I will be using vc++......
    I have to get this done as soon as possible,any help,code is very much needed and appreciated
    1. Search in MSDN
    2. Search in Google
    3. Search in CodeGuru.com
    4. Ask in the forum

    ABNM.....asih b*&6 nahi mardeh

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

Featured