Monitoring a Mailbox for certain Emails
-
- Posts: 5
- Joined: Tue Oct 13, 2009 9:15 am
- Location: Houston, TX
Monitoring a Mailbox for certain Emails
is there a method by which to monitor or poll a mailbox (imap/pop3) for a specific email to generate an alarm?
Hello,
I actually found a way to do this with using the test ActiveScript set to VBScript language. You do need to purchase or download another tool to be able to do this though. The program I used is http://www.ericphelps.com/pop3/index.htm. It just needs to be installed on the server and then create the script. An example of the script I use is below (which is just a modified version of one of the samples that came with that program). What I use this for is to let me know if I don't receive one of my regulor reports or notifications. So it doesn't sound like it does exactly what you need, but should be able to be modified to. The account does need to have pop3 enabled on the server. The script can also delete the email after it finds it.
const statusAlive = "Host is alive:"
const statusDead = "No answer:"
const statusUnknown = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk = "Ok:"
const statusBad = "Bad:"
const statusBadContents = "Bad contents:"
const checkfor = "WHAT TO CHECK FOR IN THE SUBJECT"
FUNCTION PerformTest()
PerformTest = statusBad+"Could not find email"
Dim wsh 'As Wscript.Shell
Dim pop 'As Pop3.PopApplication
Dim nCounter 'As Integer
Const WshMaximizedFocus = 3 'IWshRuntimeLibrary.WshWindowStyle
Set wsh = CreateObject("Wscript.Shell")
Set pop = CreateObject("Pop3.PopApplication")
pop.PopUserName = "ENETER IP ADDRESS HERE"
pop.PopServer = "ENTER SERVER NAME HERE"
pop.PopPassword = "ENTER USERNAME HERE"
If pop.Login Then
For nCounter = 1 to pop.Messages.Count
'Wscript.Echo pop.Messages(nCounter).Subject
If InStr(pop.Messages(nCounter).Subject,checkfor) Then
PerformTest = statusAlive+pop.Messages(nCounter).Subject
'pop.Messages(nCounter).Delete
End If
Next
End If
pop.Quit
'PerformTest = statusBad+"Could not find email" 'change this line to return proper test`s "Status" and "Reply" value to HostMonitor
END FUNCTION
I actually found a way to do this with using the test ActiveScript set to VBScript language. You do need to purchase or download another tool to be able to do this though. The program I used is http://www.ericphelps.com/pop3/index.htm. It just needs to be installed on the server and then create the script. An example of the script I use is below (which is just a modified version of one of the samples that came with that program). What I use this for is to let me know if I don't receive one of my regulor reports or notifications. So it doesn't sound like it does exactly what you need, but should be able to be modified to. The account does need to have pop3 enabled on the server. The script can also delete the email after it finds it.
const statusAlive = "Host is alive:"
const statusDead = "No answer:"
const statusUnknown = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk = "Ok:"
const statusBad = "Bad:"
const statusBadContents = "Bad contents:"
const checkfor = "WHAT TO CHECK FOR IN THE SUBJECT"
FUNCTION PerformTest()
PerformTest = statusBad+"Could not find email"
Dim wsh 'As Wscript.Shell
Dim pop 'As Pop3.PopApplication
Dim nCounter 'As Integer
Const WshMaximizedFocus = 3 'IWshRuntimeLibrary.WshWindowStyle
Set wsh = CreateObject("Wscript.Shell")
Set pop = CreateObject("Pop3.PopApplication")
pop.PopUserName = "ENETER IP ADDRESS HERE"
pop.PopServer = "ENTER SERVER NAME HERE"
pop.PopPassword = "ENTER USERNAME HERE"
If pop.Login Then
For nCounter = 1 to pop.Messages.Count
'Wscript.Echo pop.Messages(nCounter).Subject
If InStr(pop.Messages(nCounter).Subject,checkfor) Then
PerformTest = statusAlive+pop.Messages(nCounter).Subject
'pop.Messages(nCounter).Delete
End If
Next
End If
pop.Quit
'PerformTest = statusBad+"Could not find email" 'change this line to return proper test`s "Status" and "Reply" value to HostMonitor
END FUNCTION