Hylafax Mailing List Archives

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

[hylafax-users] UPDATE: RelayFax client procmail recipes



The attached .procmailrc and .faxitrc files for use with HylaFAX server,
RelayFax client use allow the faxing of multiple attachments whose filetype
is compatible with HylaFAX.  Also, it properly handles linefeeds in the
comment section, and has an option in .procmailrc to return copies of faxes
to the sender (for user archiving).

(Note that metamail, when creating files using -w option, will use a random
filename of the type mm.* for body parts that do not have a filename
associated with them - such as the ASCII body information containing all of
the fax variables *and* password.  Therefore, any attachment that matches
mm.* will not be faxed.)

Enjoy!

Lee.
: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/*

  :0
  { INCLUDERC=.faxitrc }
 }
 :0
 * ATTACHMENTNAME ?? ^^^^
 {
  :0 ic:faxtmp.lock
  | (faxcover -c "$COMMENTS" $COVERPAGE -f "$FROMNAME" -n "$TONUMBER" -r "$FAXSUBJECT" -t "$TONAME" -x "$FAXTOAT" | sendfax $PRIORITY -a "$SCHEDULE" -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/*

 :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' -e 's/%e/\\\n/g'`
ATTACHMENTNAME=`grep -e 'Content-Type.*name=' | sed -e 's/^.*name=//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`
SCHEDMO=`grep ^SCHEDULE: | sed 's/^.*\(..\).................$/\1/g' | sed \
	-e 's/01/Jan/g' -e 's/02/Feb/g' -e 's/03/Mar/g' -e 's/04/Apr/g' \
	-e 's/05/May/g' -e 's/06/Jun/g' -e 's/07/Jul/g' -e 's/08/Aug/g' \
	-e 's/09/Aug/g' -e 's/10/Oct/g' -e 's/11/Nov/g' -e 's/12/Dec/g'`
SCHEDULE=`grep ^SCHEDULE: | sed "s/^.*...\(.......\).\(........\)$/\2 $SCHEDMO \1/g"`
SCHEDULE=`if [ -n "$SCHEDULE" ]; then echo $SCHEDULE; \
	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
}

# Uncomment this recipe if you wish to have copies CC'ed back to you...
# :0 c
# ! $RETURNPATH

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

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

:0 ic:faxtmp.lock
| rm -f $METAMAIL_TMPDIR/mm.*

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

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




Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services