Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Trigger Script after email received

Reply
 
Old 3 Weeks Ago   #1 (permalink)


Windows 7 and 2008
 
 

Trigger Script after email received

Hello All, this is my first post and I'm glad to learn here in the forum..!
I have a question I'm trying to automate some process and one thing that I can't is to Trigger a Script after an email is received in to an especific email account... (Like execute the screen saver or an alert on the desktop for example)
I don't know if it's something that can be done directly with powershell and exchange or powershell and outlook... any ideas? will be really appreciated
Thanks for Your Help..!!
=) JessE

My System SpecsSystem Spec
Old 3 Weeks Ago   #2 (permalink)
Martin Zugec


 
 

Re: Trigger Script after email received

Hi there,

have a look here:
Can Powershell parse email?

You can use this to automate Outlook.

If you want more professional solution, I would recommend to have a look at
NewMail event (eventually NewMailEx)

Martin

"elJessE" <guest@newsgroup-email.com> wrote in message
news:bafa8ffa34793c01c9bd0a7e7019e7a7@newsgroup-gateway.com...
Quote:

>
> Hello All, this is my first post and I'm glad to learn here in the
> forum..!
> I have a question I'm trying to automate some process and one thing
> that I can't is to Trigger a Script after an email is received in to an
> especific email account... (Like execute the screen saver or an alert on
> the desktop for example)
> I don't know if it's something that can be done directly with
> powershell and exchange or powershell and outlook... any ideas? will be
> really appreciated
> Thanks for Your Help..!!
> =) JessE
>
>
> --
> elJessE
My System SpecsSystem Spec
Old 3 Weeks Ago   #3 (permalink)


Windows 7 and 2008
 
 

Re: Trigger Script after email received

Thank You so Much Martin, I will take a look to it...

JessE
My System SpecsSystem Spec
Old 3 Weeks Ago   #4 (permalink)
OldDog


 
 

Re: Trigger Script after email received

On Nov 3, 11:17*am, elJessE <gu...@newsgroup-email.com> wrote:
Quote:

> Thank You so Much Martin, I will take a look to it...
>
> JessE
>
> --
> elJessE
I wound up using an Outlook rule to run a script after the mail
arrived.

<----------------- Start POSH
-------------------------------------------------------------->
$path = "c:\temp\email.txt"
$info = New-Object -ComObject Outlook.Application
$objNamespace = $info.GetNamespace("MAPI")
$objFolder = $objNamespace.GetDefaultFolder(6).Folders.Item("Merchant
Reporting")
$colItems = $objFolder.Items
foreach ($item in $colItems) {
If ($item.SenderEmailAddress -eq "Bill.Smith@newsgroup") {
("$($item.SenderEmailAddress) `t $($item.SentOn) `t $
($item.Subject)")| Add-Content $path
}
}

< -------------- End Script
----------------------------------------------------------------------------
Quote:

>
What does it do?

Searches the In box for a sub folder and then for a sender.
writes them out to the screen or a file in a tab delimited format
Includes Senders name, Date/time sent and subject.
Its the `t that adds the tabs. `n adds a new line. 'r adds a line
feed
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
email not being received Vista mail
Re: Received email from myself Vista mail
Attaching an email received to an email outgoing Vista mail
RC1 email yet to be received Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46