July 09, 2002 Flattr this

CommuniGate Pro FAQ: Piping messages to a given account to a text file

Assuming you're on UNIX:

Via the router you can divert messages to a given account to an external program. The external program must reside in a special folder which is configured in the CGPro Webadmin.

So first configure the Directory for Applications with the Webadmin
Settings -> Pipe -> Application Directory

Set it to /var/CommuniGate
Set the Timeout to 2 Minutes.

Now we need to generate a little program which accepts the message as input and then pipes it to a file. We will use perl as the language of choice here.

Create the following file: /var/CommuniGate/pipeit.pl

and fill in this code:
#!/usr/bin/perl -w

open(OUTLOG, ">>pipe.out");

while (<>){
print OUTLOG $_;

Save the file and then make it executable:
chmod +x /var/CommuniGate/pipeit.pl

Now we have everything we need in place and just need to setup an appropriate ROUTER-Entry in
Webadmin -> Settings -> Router

Add something like this:
= "queue[PROC1] pipeit.pl"@pipe

This should already be it and every message send to noreply should be piped to /var/CommuniGate/pipe.out

Of course even easier is just setting up normal mbox email account which also somehow is just a textfile - only it is accessible via POP/IMAP... ;-)

Posted in: by seiz | Comments ()