Event Script interface to process emails
Question asked by Dave Lerner - December 15, 2015 at 11:12 AM
Answered
Hi,
I've been poring through this forum and can't find any way to do this. I want to create an event to fire a script (powershell, batch, whatever), where the input to the script is the name of the email file in the spool. Even the message ID would work (since I could build the path from that). However, the actions for this even do not list anything like this for the parameters available to a command-line script. I want to be able to get the name of the spool file so I can make a copy of it, and conduct header analysis, etc. Anyone have any ideas on this? I can easily do this easily on any 'nix MTA, but it seems that Smartermail does not give you the message ID or filename as possible parameter.
Thanks,
steve.

7 Replies

Reply to Thread
0
Dave Lerner Replied
I see that I can enable the proc spool folder...so maybe I'll hook in that way, but that means I'll have to write more code to ferret out one single user. meh.
0
Matt Petty Replied
Employee Post Marked As Answer
If you go to Spool settings under General Settings for Admin.
Command-Line File this would be your EXE or BAT, it passes a filepath as a parameter. I would give that a look. Make sure your process ends when it is done as SM waits for your process or Command-Line Timeout to finish.
Matt Petty
Software Developer
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
0
Dave Lerner Replied
Yeah...I know about that. The problem with that is that you're then processing every single email on the server. What I want is for the Event triggered when a single mail box gets an email to be able to pass the filename/path...your only options there are the various variables you expose like #fromaddress# or #subject#, which are not useful, I need the filename...or heck, even just the messageid... like, #messageid#. Any way to do this?
0
Matt Petty Replied
Employee Post
I'll see what I can do, that shouldn't be difficult.
Matt Petty
Software Developer
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
0
Matt Petty Replied
Employee Post
I would make a feature request so that this can be tracked, I looked quickly at it and it seems like you would also need an event type to be added as well not just a variable. It seems like you want to touch this file before it is delivered.
Matt Petty
Software Developer
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
0
Dave Lerner Replied
Well, for sure the variable...I guess a new event type as well. I was able to write a node.js filewatcher script, and install it as a service to watch the proc folder, but that is again, pawing through every single email, but it does work. And, with it, in the future, I can add more hooks quite easily. But something built into the server like the event especially if it can be tied to a particular domain would be even better. I think this could be done with the software from MightyBlue.com, the ultimate spool manager, but frankly, I've already built what they have with my node.js folder watcher.

Thanks for taking the time to entertain this!
0
Matt Petty Replied
Employee Post
Well it seems like your option definitely allows you to do a lot more than the event system could. Node.js is really picking it up, I'm seeing it used more and more everyday for various things.
Matt Petty
Software Developer
SmarterTools Inc.
(877) 357-6278
www.smartertools.com

Reply to Thread