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 791813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:53:51+00:00 2026-05-14T21:53:51+00:00

I have Exchange 2010 and I need to run a process using web services

  • 0

I have Exchange 2010 and I need to run a process using web services against every new email to come in to a mailbox. The process will basically add the email to an internal task list.

Can I use Powershell for this?

Having never used Powershell before I don’t really have a clue on it’s capabilities.

If not can anyone suggest another way of doing this other than monitoring the mailbox every X seconds. Really I’d like it event based so if no new mail then no processing.

Cheers,
Mike

  • 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-14T21:53:51+00:00Added an answer on May 14, 2026 at 9:53 pm

    I have spent a few days looking into this and it seems that it’s very difficult to add custom code to an incoming email event. And many of the methods of doing it will just get ignored if Exchange thinks it’s slowing down the email system. (http://www.outlookcode.com/article.aspx?id=62)

    The other method is to hook into the SMTP events which works but feels at bit of a hack. To do that you need to write a wscript then register that against the event of arrival of an email.

    Here is an example vb script for adding a random hex reference onto every email which comes via SMTP.

    <SCRIPT LANGUAGE="VBScript">
    
    Sub IEventIsCacheable_IsCacheable()
        'To implement the interface, and return S_OK implicitly
    End Sub
    
    Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus)
        Dim Flds
    
        randomize()
    
        set Flds = Msg.Fields
        With Flds
            strSubject = .Item("urn:schemas:httpmail:subject")
    
            if instr(strSubject, "Ref=") = 0 then
                strSubject = Replace(strSubject, CHR(9), "") & " (Ref=" & hex(replace(timer(), ".", "")) & hex(rnd()) & ")"
                .Item("urn:schemas:httpmail:subject") = strSubject
                .Update
            else
                strSubject = LEFT(strSubject, instr(strSubject, "(Ref=") - 1) & MID(strSubject, instr(instr(strsubject, "(Ref="), strSubject, ")") + 1, Len(strSubject)) & " (Ref=" & hex(replace(timer(), ".", "")) & hex(rnd()) & ")"
                .Item("urn:schemas:httpmail:subject") = strSubject
                .Update
            end if
        End With
    
        Msg.Datasource.Save
    
        EventStatus = 0 'Run next sink
    
    End Sub
    
    </SCRIPT>
    

    Then to register the script run this.

    Cscript smtpreg.vbs /add 1 onarrival SMTPAddRef CDO.SS_SMTPOnArrivalSink "mail from=*"
    Cscript smtpreg.vbs /setprop 1 onarrival SMTPAddRef Sink ScriptName "C:\ENTERPATH\SMTPRef.vbs"
    

    To unregister the script run the follow;

    cscript smtpreg.vbs /remove 1 onarrival SMTPAddRef
    

    The most resilient method seems to be to create a timer based system to check for new mails every X minutes.

    Not as slick as I was hoping for but it’ll do.

    Hope this helps others.

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

Sidebar

Related Questions

I'm using EWS (Exchange Web Services) with Exchange 2010 to generate and send emails
We have a device that uses Exchange web services to download mail and calendar
I've written a C# program using managed Exchange Web Services (EWS) to query a
I am trying to consume the Exchange 2010 Web Service interface using JAX-WS. I'm
I have a program that subscribes to multiple Exchange 2010 mailboxes using EWS Managed
I am attempting to run the following PowerShell command against my Exchange 2010 SP1
I need to create a mailbox on an exchange 2003 server using python. The
I have Exchange 2010 running and i need to track all the emails. I
I am attempting to connect to exchange web services (ews) on a exchange 2010
Since working with Exchange Web Services 2010 is a bit ridiculous, especially from anything

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.