HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-users] UPDATE: new rc files support RelayFax 3.0



For any of you (are there any?) who may use my .procmailrc and .faxitrc
files to interface RelayFax (Windows client) with HylaFAX, I have made a
number of improvements to them which support new features in the RelayFax
3.0 Client software.  I am attaching the new rc files.

Improvements and new features in this version are:

* The new 3.0 client feature of "Send priority (0-100)" is used to pass
priority information to HylaFAX.
* The new 3.0 client feature of "Send Schedule" is used to pass scheduling
information to HylaFAX.  HylaFAX allows fax scheduling up to one year in
advance.  This has been implemented in these scripts.  Consequently, faxes
to be sent "immediately" are sent one minute later rather than "now".
(This was to ease the script length of .faxitrc.)
* Custom (per client/sender) fax cover pages are used, if available.  These
custom cover pages should be placed in the $HOME directory of the faxing
account on the server.  They need to be named as the e-mail address of the
sender.  For example if I were to send a fax using "johndoe@mydomain.com"
as my return-path, then my custom cover page would need to be named
johndoe@mydomain.com.
* Significant simplification was made to the .faxitrc script.

Further easy-to-develop improvements could be:

* The new client software sends a good deal of sender information (address,
fax number, phone number, etc.) in the body of the e-mail, which could be
used with a third-party program to further customize fax cover pages.
Unfortunately, neither faxcover nor sendfax can utilize these variables.
* Also, "billing" information is sent with the body of the fax-email.  This
could be utilized if needed in a commercial application.

Improvements that I would like to see, but don't plan on implementing soon:

* Multiple attachments can be placed on any fax-email beyond the automatic
print-generated TIFF.  Currently, these scripts only make use of one
attachment, and I have not tested what problems may occur with multiple
attachments.  However, there have been moments when I would have found it
useful to attach other TIFF documents to the fax-email, or perhaps PDF or
PostScript doucuments.  If anyone feels up to a challenge... ;-)

Let me know if you have troubles.  I have only used these on Linux systems
(mostly RedHat), so if your systems' date functions don't work as mine,
well... it's open-source, so have at it!

Thanks.

Lee Howard
:0
* ! FAXDESTINATION ?? ^^^^
{
 FAXTOWHOM=`echo $FAXDESTINATION | sed 's/^\([^¿]*\) ¿.*/\1/'`
 FAXTOAT=`echo $FAXTOCOMPANY | sed 's/^\([^¿]*\) ¿.*/\1/'`
 TONAME=`echo $FAXTOWHOM | sed 's/^\([^\@]*\)@.*/\1/'`
 TONUMBER=`echo $FAXTOWHOM | sed 's/^[^\@]*@\(.*\)/\1/'`
 FAXDESTINATION=`echo $FAXDESTINATION | sed 's/^[^¿]* ¿\(.*\)/\1/'`
 FAXTOCOMPANY=`echo $FAXTOCOMPANY | sed 's/^[^¿]* ¿\(.*\)/\1/'`
 :0
 * NOCOVERPAGE ?? ^^TRUE^^
 {
  :0 ic:faxtmp.lock
  | sendfax $PRIORITY -a "$SCHEDULE" -f "$FROMLINE" $CONFIRMSEND -n -d "$FAXTOWHOM" $METAMAIL_TMPDIR/$ATTACHMENTNAME

  :0
  { INCLUDERC=.faxitrc }
 }
 :0
 * ATTACHMENTNAME ?? ^^^^
 {
  :0 ic:faxtmp.lock
  | (faxcover -c "$COMMENTS" -f "$FROMNAME" -n "$TONUMBER" -r "$FAXSUBJECT" -t "$TONAME" -x "$FAXTOAT" | sendfax $PRIORITY -a "$SCHEDULE" $COVERPAGE -n -f "$FROMMAIL" $CONFIRMSEND -d "$FAXTOWHOM")

  :0
  { INCLUDERC=.faxitrc }
 }
 :0 ic:faxtmp.lock
 | sendfax $PRIORITY -a "$SCHEDULE" $COVERPAGE -f "$FROMLINE" $CONFIRMSEND -r "$FAXSUBJECT" -c "$COMMENTS" -x "$FAXTOAT" -d "$FAXTOWHOM" $METAMAIL_TMPDIR/$ATTACHMENTNAME

 :0
 { INCLUDERC=.faxitrc }
}
:0 i
/dev/null
# - .procmailrc file for use with Deerfield's RelayFax as a Windows client
# and HylaFAX as the fax server
# - faxes should be directed to the user where this .procmailrc file is placed
# - faxes may also be sent manually by attaching a tif or ps file to an e-mail
# with the fax number being the subject line

RETURNPATH=`grep -e "return-path" -i | sed "s/^.*<//;s/>//"`
MAILSUBJECT=`grep -e "^subject" -i | sed 's/[Ss]ubject. //g' | sed 's/\ //g'`
PRINTEDFAX=`grep -e PRINTEDFAX | sed -e 's/PRINTEDFAX: //g'`
FAXDESTINATION=`egrep -e '^(FAX|CC)NUMBER' | sed -e 's/^.*NUMBER: \([^,]*\), "\([^"]*\)", "[^"]*"/\2\@\1 ¿/'`
FAXTOCOMPANY=`egrep -e '^(FAX|CC)NUMBER' | sed 's/^[^,]*, "[^"]*", "\([^"]*\)"/\1 ¿/'`
FAXPASSWORD=`grep -e FAXPASSWORD | sed -e 's/FAXPASSWORD: //g'`
FROMNAME=`grep -e FROMNAME | sed -e 's/FROMNAME: //g'`
FROMMAIL=`grep -e FROMLINE | sed -e 's/FROMLINE: //g'`
FROMLINE=$FROMMAIL\ \($FROMNAME\)
NOCOVERPAGE=`grep -e NOCOVERPAGE | sed -e 's/NOCOVERPAGE: //g'`
CONFIRMSEND=`if [ \`grep -e CONFIRMSEND | sed -e 's/CONFIRMSEND: //g'\` = TRUE ]; then echo "-R"; else echo; fi`
FAXSUBJECT=`grep -e FAXSUBJECT | sed -e 's/FAXSUBJECT: //g'`
COMMENTS=`grep -e COMMENTS | sed -e 's/COMMENTS: //g'`
ATTACHMENTNAME=`grep -e 'Content-Type.*name=' | sed -e 's/^.*name=//g' | sed -e 's/\"//g'`
ATTACHMENTFILENAME=`grep -e '.*filename=' | sed -e 's/^.*filename=//g' | sed -e 's/\"//g'`
METAMAIL_TMPDIR="$HOME/faxtmp"
PASSWDCHECK=`grep -e "$RETURNPATH $FAXPASSWORD" $HOME/faxuserlist`
HOST=`hostname -f`
PRIORITY=`echo \$[\`grep ^PRIORITY | sed 's/^.* //g'\`*255/100]`
PRIORITY=`if [ -n "$PRIORITY" ]; then echo "-P $PRIORITY"; fi`
COVERPAGE=`if [ -f "$RETURNPATH" ]; then echo "-C \"$RETURNPATH\""; fi`

# sendfax accepts future-date scheduling in "HH:MM [AM|PM] + N period(s)"
DAYNOW=`date -d "\`grep ^Date: | sed 's/^Date: //g'\`" +%j`
DAYNOW=`echo $DAYNOW | sed 's/^0*//g'` # keep it in decimal format
YRNOW=`grep ^Date: | sed 's/^.*.......\(....\)...............$/\1/g'`
DAYSCHED=`date -d "\`grep ^SCHEDULE: | sed 's/^SCHEDULE: //g'\`" +%j`
DAYSCHED=`echo $DAYSCHED | sed 's/^0*//g'`
YRSCHED=`grep ^SCHEDULE: | sed 's/^.*......\(....\).........$/\1/g'`
LEAPYR=`if [ \`date -d "12/31/$YRNOW" +%j\` = 366 ]; then echo 1; else echo 0; fi`
DAYS2SEND=`if [ $YRSCHED -gt $YRNOW ]; then echo $[$DAYSCHED+365+$LEAPYR-$DAYNOW]; \
	else echo $[$DAYSCHED-$DAYNOW]; fi`
NOWHR=`grep ^Date: | sed 's/^.*............\(..\)............$/\1/g'`
NOWMI=`echo $[$NOWHR*60+\`grep ^Date: | sed 's/^.*...............\(..\).........$/\1/g'\`]`
SCHEDHR=`grep ^SCHEDULE: | sed 's/^.*...........\(..\)......$/\1/g'`
SCHEDHR=`if [ \`grep ^SCHEDULE: | sed 's/^.*.................\(..\)$/\1/g'\` = PM ]; \
	then echo \$[$SCHEDHR+12]; else echo $SCHEDHR; fi`
SCHEDMI=`echo $[$SCHEDHR*60+\`grep ^SCHEDULE: | sed 's/^.*..............\(..\)...$/\1/g'\`]`
DAYS2SEND=`if [ $NOWMI -ge $SCHEDMI ]; then echo $[$DAYS2SEND-1]; else echo $DAYS2SEND; fi`
TIME2SEND=`grep ^SCHEDULE: | sed 's/^.*...........\(........\)$/\1/g'`
SCHEDULE=`if [ -n "$TIME2SEND" ]; then echo "$TIME2SEND + $DAYS2SEND days"; \
	else echo "now + 1 minute"; fi`

:0
* ! $PASSWDCHECK ?? ^^$RETURNPATH $FAXPASSWORD^^
* ! ^FROM_DAEMON
* ! ^X-Loop
{
 :0
 | (formail -r -A"X-Loop: $USER@$HOST" ; \
	echo "FAX ERROR: You do not have permission to fax.") | $SENDMAIL -t

 :0:faxtmp.lock
 /dev/null
}
:0 ic:faxtmp.lock
| rm -f $METAMAIL_TMPDIR/*

:0 ic:faxtmp.lock
| metamail -w -x

:0
* PRINTEDFAX ?? ^^TRUE^^
{ INCLUDERC=.faxitrc }

:0 i:faxtmp.lock
| sendfax -f "$RETURNPATH" -n -d "$MAILSUBJECT" $METAMAIL_TMPDIR/$ATTACHMENTFILENAME





Project hosted by iFAX Solutions