Is there any way to read mails from Outlook without configuring the account? RRS feed

  • Question

  • Is there any way to read mails Programmatically from Outlook without configuring the account?

    MAPI requires outlook to be configured Vijay Gupta

    • Edited by gupta vijay Tuesday, December 24, 2013 2:05 PM
    Tuesday, December 24, 2013 12:47 PM


All replies

  • Hello Gupta Vijay,

    You can use classes from the System.Net namespace for sending e-mails programmatically. For example, the SmtpClient class allows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP). Also I have found the POP3 Email Client with full MIME Support (.NET 2.0) article for you.

    If you want to read e-mails from a *.pst file offline (not a server) you need to parse it manually. You can find the Outlook Personal Folders (.pst) File Format described in MSDN.

    Tuesday, December 24, 2013 1:40 PM
  • Sorry. I forgot to mention that I need to do it programmatically (preferably using VBScript). Can it be done? Vijay Gupta

    Tuesday, December 24, 2013 2:04 PM
  • Could you please clarify what exactly do you need to do?

    Do you want to open the *.pst file and read e-mails? If so, you can use the Outlook Personal Folders (.pst) File Format.

    Tuesday, December 24, 2013 2:12 PM
  • No. I want to read from the server. Vijay Gupta

    Tuesday, December 24, 2013 2:42 PM
  • Well, it looks like your task is not related to Outlook then. I would recommend asking such questions in the VBScript related forums.
    Tuesday, December 24, 2013 2:43 PM
  • What server?

    Exchange (use EWS)?

    POP3 or IMAP4? There are literally thousands of components/libraries that you can use from just about any programming language.

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, December 24, 2013 4:40 PM
  • Hi Gupta.

    If the Outlook server is Exchange, I would recommend you to get more effective responses from Exchange Server Development.

    I found a possible solution from Reading emails from Exchange Public folder.

    In addition, Microsoft Office for Developers forum is used to discuss development questions about VBA, VSTO, Office apps and so on. If you have questions about Office development, feel free to post here.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, December 25, 2013 10:44 AM
  • By Server, I meant to say: Manually, if we want to read mails, then we need to configure the account in Outlook. Now, if I want to do it programmatically, then I can do it easily using MAPI object but for that Outlook needs to be configured on the computer for the specific account for which I want to read mails.

    The requirement is: I want to read the mails for the specific account programmatically without configuring that account in Outlook on that computer. Can it be done programmatically?

    Also, please let me know the correct forum to ask this question if this is not the correct one.

    Please let me know if I am not clear or need more information. Vijay Gupta

    • Edited by gupta vijay Wednesday, December 25, 2013 11:31 AM
    Wednesday, December 25, 2013 11:29 AM
  • So are you asking how to add a particular account type (Exchange, POP3/SMTP, etc.) to Outlook or how do access POP3, IAMP4 or Exchange server and copy its messages to Outlook effectively bypassing Outlook accounts?

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, December 25, 2013 3:43 PM
  • No Dimitri. I am just asking if there is any way using any API from which we can read messages for exchange account?

    We can do that using MAPI, however, for that , Outlook needs to be configured and we want to avoid that. Vijay Gupta

    Thursday, December 26, 2013 8:53 AM
  • Hello gupta vijay,

    You are right: you can use Messaging API for accessing e-mails. In that case you need to have an account configured. But you are not limited that way.

    If you need to read Exchange account's e-mails you can use WebDAV in case of Exchange server 2003. If you use older versions the best way to interact with Exchange programmatically is via the new Exchange Web Services interface which uses SOAP and is a lot more programmer friendly and well documented than WebDAV or even MAPI.

    For example, I have found the following articles with sample code in VBScript for you:

    How to connect to and read data from Mailboxes, Calendars, … via Exchange Web Services and vbScript?

    Howto: Read OOF info using EWS and VBScript against an Exchange 2010 SP1

    Sending Email through Exchange 2010 EWS with VBScript

    • Edited by Eugene Astafiev Thursday, December 26, 2013 10:30 AM
    • Marked as answer by gupta vijay Friday, December 27, 2013 11:46 AM
    Thursday, December 26, 2013 10:29 AM
  • Thanks Eugene. We are using Exchange 2007. I think the code would be the same for that also. Vijay Gupta

    Friday, December 27, 2013 11:46 AM