Proram Delivery
Greetings,
I have been trying to get Program Delivery to work for a long time with both scripts and binary executables. I always have the same problem.
The documentation states that Messaging server first starts the program, then "feeds" the message to the program. I have not figured out how that message is "fed" to the program.
Can anyone help me out on this. Any example source code would be warmly welcomed.
[446 byte] By [
706052] at [2007-11-25 8:33:33]

as with the standard sendmail pipe mecanism, the entire mail is passed to your program via STDIN, so one of the first thing you program has to do is begin to read it's stdin to get the mail. it is the raw mail (headers, one empty line, body)
Hi,
here's a few tips that might help
1st. have a mail group or account have the mailprogramdeliveryinfo attribute set to the name of your registered program. here i am using an example of smsprog
2nd. register the program
/opt/iplanet/ims6.2/sbin/imsimta program -a -m smsprog -p sms/smsfilter.sh
To check
# ./imsimta program -l
==================================================
Method_name: smsprog
Program_name: /opt/iplanet/ims6.2/data/site-programs/sms/smsfilter.sh
Execute Permission : Postmaster
==================================================
3rd. In your program you need an entry like this:
FNAME=/tmp/SMS.$$.tmp
cat - >$FNAME
The cat line takes the email as stdin an feeds it into the variable FNAME (it can be any variable name)
You now have the whole message in text form, headers included.
You can then pull it apart for delivery e.g.
####### TAKE HEADERS FROM FNAME2 AND PUT IN FNAME #######
N2=`grep -n "^$" $FNAME2 | head -1 | cut -d":" -f1`
HEADERS=`head -$N2 $FNAME2`
echo "$HEADERS\n" > $FNAME
cheers