- This topic has 4 replies, 3 voices, and was last updated 15 years, 3 months ago by .
-
Topic
-
Hi Everyone, Anyone out there using blat on windows server for emails. I need help in writing the correct syntax to execute blat from within tcl.
This is what I am trying to achieve:
If ordering and billing provider is missing in ZS1 segment, send an email out to a distribution list.
Here is my proc
Name: uchc_ngen_email
# Purpose:
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (“start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#
proc uchc_ngen_email { args } {
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
# Here we retrieve the original message
set msg [msgget $mh]
#Body of the email
set EmailMsg “$msg”
#Email subject
set subject “Missing ordering and billing provider”
#Email Address
set address “
sharma@uchc.edu “#Parse the Message
lassign [split [crange $msg 3 7] {}] fsep csep rsep esep ssep
set msglist [split $msg r]
#Find the segment
set seg [lmatch -regexp [split $msg r] ^ZS1]
set billingprov [lindex [split $seg $fsep] 4]
echo “Billing Provider” $billingprov
set orderingprov [lindex [split $seg $fsep] 5]
echo “Ordering provider” $orderingprov
#Filter
if {[cequal $billingprov “”] && [cequal $orderingprov “”]} {
set cmd “blat -subject $subject -body $EmailMsg -to $address”
if {[catch $cmd result]} {
echo “ERROR: An error occurred running “$cmd”.”
echo ” Result was: $result”
}
lappend dispList “KILL $mh”
return $dispList
} else {
lappend dispList “CONTINUE $mh”
return $dispList
}
}
time {
# Timer-based processing
# N.B.: there may or may not be a MSGID key in args
}
shutdown {
# Doing some clean-up work
}
}
return $dispList
}
- The forum ‘Cloverleaf’ is closed to new topics and replies.