Script to parse email subject, get Username, look up in GAL and redirect email

Status
Not open for further replies.

se2k

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hi everyone,

I'm hoping someone can help here.

I'm looking to use Powershell (or anything else if someone can suggest something better) to do the following:

1) Monitor a mailbox for incoming email (mailbox alias name: webmeetings)

2) Check the subject of the email for the phrase "Web Meeting Request"

3) Parse the subject of the email and get the Username from it. The email would have a subject like "Username - Web Meeting Request" where Username would be a user's Username (e.g. MatthewG - Meeting Request)

4) Based on the Username, get the user's email address. The user would be in our Global Address List so the script could get the user's email address from the GAL (e.g. MatthewG -> Matthew.Gibbons@company.com)

5) Redirect (or forward) the email to the user's GAL email address.

6) Delete the email from the "webmeetings" mailbox after redirecting/forwarding it

Thanks in advance for any help!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Re: Script to parse email subject, get Username, look up in GAL and redirect e

Is the mailbox set up in Outlook?

You can an event sink or EWS on the server (it would run all the time), although I don't have any code samples. I also don't have any for powershell solutions. It is possible using VBA in Outlook for sure, but the mailbox needs to be open in outlook.
 

se2k

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Re: Script to parse email subject, get Username, look up in GAL and redirect e

Is the mailbox set up in Outlook?

You can an event sink or EWS on the server (it would run all the time), although I don't have any code samples. I also don't have any for powershell solutions. It is possible using VBA in Outlook for sure, but the mailbox needs to be open in outlook.
This mailbox isn't set up in Outlook. We are hoping to have this script run on a server without the need for Outlook.

Another thing I should mention is that all our users are in Active Directory so the username could be looked up in Active Directory to get the SMTP email address for forwarding/redirecting.

Code samples would really be helpful.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Re: Script to parse email subject, get Username, look up in GAL and redirect e

the username isn't the problem - you should only need the alias and it *should* resolve and be delivered. To do this server-side, you need to use Exchange web services (EWS) or an event sink. Generally speaking, with newer exchange servers, EWS is a better option.
 

se2k

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Re: Script to parse email subject, get Username, look up in GAL and redirect e

the username isn't the problem - you should only need the alias and it *should* resolve and be delivered. To do this server-side, you need to use Exchange web services (EWS) or an event sink. Generally speaking, with newer exchange servers, EWS is a better option.
We do have EWS. Some code samples would really be helpful though. I have very limited experience with Powershell scripts.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Re: Script to parse email subject, get Username, look up in GAL and redirect e

I'll see if i can find some. I looked earlier and came up with zip.
 

Oooo

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Re: Script to parse email subject, get Username, look up in GAL and redirect e

Hi everyone,

I'm hoping someone can help here.

I'm looking to use Powershell (or anything else if someone can suggest something better) to do the following:

1) Monitor a mailbox for incoming email (mailbox alias name: webmeetings)

2) Check the subject of the email for the phrase "Web Meeting Request"

3) Parse the subject of the email and get the Username from it. The email would have a subject like "Username - Web Meeting Request" where Username would be a user's Username (e.g. MatthewG - Meeting Request)

4) Based on the Username, get the user's email address. The user would be in our Global Address List so the script could get the user's email address from the GAL (e.g. MatthewG -> Matthew.Gibbons@company.com)

5) Redirect (or forward) the email to the user's GAL email address.

6) Delete the email from the "webmeetings" mailbox after redirecting/forwarding it

Thanks in advance for any help!
What Exchange do you use ? If 2007/2010 you can or you should write Transport Agent using C#. It can do many operations with incoming / outgoing messages.
 
Status
Not open for further replies.
Top