Jump to content

New email notification


enaiman
 Share

Recommended Posts

I am trying to put together a sort of SMS gateway. Before trying to reinvent the wheel, I had a look at whatever was available on the market and I found them lacking in features or too damn expensive.

The only way I can go is email to SMS (for integration purposes)

Finally I've decided to give it a go.

I wrote a script to send the necessary commands to my GSM module via its serial interface.

Now I need a mailbox to catch all undelivered emails (the emails intended to be sent out as SMS will be addressed to xxxxxxxx@mydomain.local, where xxxxxx is the phone number), because obviously there isn't such an email account. I've managed to find how to do this in Exchange 2010 ("postmaster" mailbox) http://technet.microsoft.com/en-us/library/bb430765.aspx

The above parts I can do them, no problem - the tricky part is the one I am asking for help.

I need a "trigger" (to detect when new email arrived in the postmaster mailbox) and a way for my script to get that email (the address and the body).

Speaking about the "trigger" - I found something on msdn - MAPI Notifications Events - New mail (fnevNewMail) http://msdn.microsoft.com/en-us/library/cc840027.aspx - the problem is, I have no idea how can I use that.

Next part: getting the content of the new email - no idea again.

I would really appreciate any help.

Thanks

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Please have a look at this It displays SenderName and Subject when a new mail arrives.

Details can be found here.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi water,

Thank you very much for your help. I knew about your Outlook UDF and everything would work perfectly if I had Outlook installed on that machine.

I don't know if I should spend about $300 for a copy of MS Office just to have this functionality; it does look expensive :)

This weekend I had a look at other mail clients (free ones) and Mozilla Thunderbird seem to be the best out there but unfortunately none of the mail clients I found can't "do something" (run a script/executable) when new mail arrives.

So, I am not in a very fortunate position.

Any other ideas?

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Hi enaiman,

I don't know anything about Thunderbird. But a quick Google search led me to the assumtion that Thunderbird supports events by a construct called "listeners" as well.

Maybe this is a good start: Subscribe to new mail event in Thunderbird or Getting notified when new mail arrives in Thunderbird.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

enaiman

Check the message filtering options of the mail clients you looked at, some can run an application as a filter option.

The FiltaQuilla Thunderbird extension adds new message filter options.

Run or Launch a file, Save Message as File (use with Move Later option if moving messages from InBox), run javascript, etc.

http://mesquilla.com/extensions/filtaquilla/

It has a filter option to run a file with command line params - Subject, Sender, Date, etc, but header only info,

apparently there is an issue with mozilla core code not supporting streaming the message.

http://mesquilla.com/forum/filtaquilla/h...ess-body-of-email-with-externa)

http://mesquilla.com/forum/filtaquilla/how-to-get-message-body/

http://mesquilla.com/forum/filtaquilla/run-file/

You can check a filter option to save the message as an eml file in the folder of your choice,

the file is named with the subject line (duplicates have subject line with added number)

You could then read the message from the script instance using something like @TempDir & "\MyMsgFolder\" & $CmdLine[X] & ".eml"

delete the file, then parse the message to remove the header.

example InBox filter: check sender field, run script with subject,sender and date strings, save message to eml file

Run File: thunderbird-runtest.exe,@SUBJECT@,@AUTHOR@,@DATE@

Save Message as File: "your message folder"

#include <Array.au3>
Local $sMsg = FileRead(@TempDir & "\MyMsgFolder\" & $CmdLine[1] & ".eml")
FileDelete(@TempDir & "\MyMsgFolder\" & $CmdLine[1] & ".eml")
Local $aCmd = $CmdLine
Local $aArray = StringSplit($sMsg, @CRLF, 3)
_ArrayConcatenate($aCmd, $aArray)
_ArrayDisplay($aCmd)

I see fascists...

Link to comment
Share on other sites

Good luck!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...