Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6103065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:41:09+00:00 2026-05-23T13:41:09+00:00

I want to process incoming mails coming from an exchange server and save it

  • 0

I want to process incoming mails coming from an exchange server and save it in my mail box. As of now I can get an alert for every incoming mail.

How can I get the body of the email to process it?

   public partial class ThisAddIn
   {
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
                this.Application.NewMail += new ApplicationEvents_11_NewMailEventHandler(AlertWhenNewMail);
            }
            void AlertWhenNewMail()
            {
                MessageBox.Show("New Email Recieved");
            }

            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            {
            }
            #region VSTO generated code
            private void InternalStartup()
            {
               this.Startup += new System.EventHandler(ThisAddIn_Startup);
               this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
            }
            #endregion
    }

Also, how to save the email and then just store it in the inbox folder?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:41:10+00:00Added an answer on May 23, 2026 at 1:41 pm

    To get to the actual mailItem, use the entryID passed in the newMailEx event. Your response to other posts suggests this doesn’t work for you somehow, but I’ll assume we’ll get that sorted out and provide you some example code:

    void MyApplication_NewMailEx(string anEntryID)
    {
      Outlook.NameSpace namespace = this.GetNamespace("MAPI");  
      Outlook.MAPIFolder folder = this.Session.GetDefaultFolder( Outlook.OlDefaultFolders.olFolderInbox );
      Outlook.MailItem mailItem = (Outlook.MailItem) outlookNS.GetItemFromID( anEntryID, folder.StoreID );
    
      // ... process the mail item
    }
    

    To answer the second part of your question, once you get hold of the mail item through this event it has already been saved into your inbox, so no need to do anything there. You’d save it to disk using MailItem.SaveAs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run a weekly batch process in an asp.net page. How can
I want to automate a Windows 2000+ server reboot process using Task Scheduler or
I have 1 process that receives incoming connection from port 1000 in 1 linux
I want to create a web page where users can initiate a process, this
I want to process each source code file after it has been preprocessed: myprocess
I want to spawn another process to display an error message asynchronously while the
I want to upload and then process a file in a Ruby on Rails
I want to kill a whole process tree. What is the best way to
I want to wait for a process to finish, but Process.WaitForExit() hangs my GUI.
I want to obtain maximum performance out of a process with many variables, many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.