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.
Thread starter Similar threads Forum Replies Date
D Script to parse email and set a task Outlook VBA and Custom Forms 1
D.Moore VBA script fail after Office 365 update Using Outlook 8
M Outlook 2013 Script Assistance - Save Opened Link with Subject Added Outlook VBA and Custom Forms 1
F Script for zip file attachment Outlook VBA and Custom Forms 1
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
Y Outlook 2013 Run A Script Outlook VBA and Custom Forms 4
Z Script to set account? Using Outlook 0
dweller Outlook 2010 Rule Ignores VBA Script Outlook VBA and Custom Forms 2
N VBA Script to Open highlighted e-mail and Edit Message Outlook VBA and Custom Forms 5
B Outlook rule run a Script doesn't work Outlook VBA and Custom Forms 1
J Calling a Public sub-routine from the script editor via VB script Outlook VBA and Custom Forms 4
K Outlook Archive to PST Files by Date Range VBA Script? Outlook VBA and Custom Forms 1
Peter H Williams Enable script containing VBA Outlook VBA and Custom Forms 12
H VB script in outlook form doesn't work anymore Outlook VBA and Custom Forms 2
A Script to fetch data from mails in restricted collection and sending them to excel Using Outlook 1
B Wanting to run a script that will filter any body that has a russian link in it. Outlook VBA and Custom Forms 5
Bri the Tech Guy Registry Tweak to make "Run a Script" Action Available Outlook VBA and Custom Forms 2
V VB script code to save a specific email attachment from a given email Outlook VBA and Custom Forms 14
Bri the Tech Guy Run Script rule not running for newly arriving messages Outlook VBA and Custom Forms 25
M Subject Line Automation - Trigger Script Delayed Outlook VBA and Custom Forms 2
Q Script to create a pst file for Archiving Using Outlook 1
Vijay Error in rule- Run a script Using Outlook 1
R VBA Script Quick Parts Using Outlook 1
Vijay Run script doesn't work in outlook Using Outlook 1
Q VBA Script to move item in secondary mailbox Outlook VBA and Custom Forms 2
Diane Poremsky Run a Script Rule: Send a New Message when a Message Arrives New Slipstick.com Articles 2
F Avoid sending duplicate using Outlook script Outlook VBA and Custom Forms 2
oliv- How to Run a Script IN AN ADDIN with Outlook's Rules and Alerts Outlook VBA and Custom Forms 2
L Run a Script Rule doesn't work Using Outlook 5
N Outlook script to forward emails based on senders' address Outlook VBA and Custom Forms 2
S using script rule to save attachments on arrival Outlook 2010 Outlook VBA and Custom Forms 9
X Outlook script to run excel data Outlook VBA and Custom Forms 1
N VBA Script to Send Automatic Emails from Outlook 2010 Outlook VBA and Custom Forms 1
Davzell Change default pop3 account with script, prf or registery ? Outlook VBA and Custom Forms 0
D RUN SCRIPT WHEN OUTLOOK IS CLOSE Outlook VBA and Custom Forms 1
L Cannot run script from rule Outlook VBA and Custom Forms 7
O modify vba to run it as script rule Outlook VBA and Custom Forms 8
L Moving Message Class email via script and Rule Outlook VBA and Custom Forms 3
P How many subs can run in one outlook VBA script Using Outlook 5
H Customizing "Send to" Attachment Script Outlook VBA and Custom Forms 5
G Script in rule to send to multiple emails found in message bo Outlook VBA and Custom Forms 11
Xueying run a script in rules, first time succeed, failed afterwards Outlook VBA and Custom Forms 3
A Creating archive rule on the clients by script/ Outlook VBA and Custom Forms 3
J VBS Script (macro) for word to open Outlook template. Outlook VBA and Custom Forms 2
J Email Parsing VBA Script for Outlook - NEEDED Outlook VBA and Custom Forms 7
P Vba script including macro appears in rules but wont run Outlook VBA and Custom Forms 6
R Adding vba to script list Outlook VBA and Custom Forms 4
O Script to move emails to a folder based on various possible keywords Outlook VBA and Custom Forms 11
Jeff Rott Diane Question on "Use in a Run a Script Rule" Outlook VBA and Custom Forms 1
Stig Arvidsson Need a Script for handling moved mail from inbox Using Outlook 3
Similar threads


















































Top