/usr/lib/courier/faxmail/new_fax is in courier-faxmail 0.73.1-1.6.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | #!/bin/sh
#
# Install this script as mgetty+sendfax's new_fax script (usually in
# /usr/local/lib/etc/mgetty+sendfax, or /etc/mgetty+sendfax), to automatically
# convert incoming faxes to PNG attachments, and mailing them
prefix="/usr"
exec_prefix="/usr"
bindir="/usr/bin"
sbindir="${exec_prefix}/sbin"
sysconfdir="/etc/courier"
. $sysconfdir/faxnotifyrc
if test "$3" -lt 1
then
exit 0
fi
makemessage() {
STATUS="$1"
shift
FAXID="$1"
shift
PAGES="$1"
shift
echo "To: $TOHDR"
echo "From: $FROMHDR"
echo "Subject: $SUBJECTHDR"
echo "Mime-Version: 1.0"
echo "Content-Type: multipart/mixed; boundary=courierfax"
echo ""
echo "This is a MIME formatted message"
echo ""
echo "--courierfax"
FILE="$1"
BASENAME="`echo $1 | /bin/sed 's:.*/::'`"
RES="`echo $BASENAME | /usr/bin/cut -c2`"
TTY="`echo $BASENAME | /bin/sed 's/-.*//;s/.*\(..\)$/\1/'`"
FAXID="`echo $BASENAME | /bin/sed 's/^[^-]*-//;s/\.[0-9][0-9]*$//'`"
if test "$RES" = "f"
then
RES="Fine"
else
RES="Low"
fi
(
if test "$STATUS" = 0
then
:
else
echo "PARTIAL FAX - TRANSMISSION INTERRUPTED AFTER $PAGES PAGES"
fi
echo ""
echo "Pages: $PAGES"
echo "Resolution: $RES"
echo "Modem line: tty$TTY"
if test "$FAXID" = ""
then
:
else
echo "Sender's FAX ID: $FAXID"
fi
echo ""
) | /usr/bin/makemime -c "text/plain" -e "quoted-printable" -
PAGENUM=1
while test $PAGENUM -le $PAGES
do
echo ""
echo "--courierfax"
FILE="$1"
BASENAME="`echo $1 | /bin/sed 's:.*/::'`"
RES="`echo $BASENAME | /usr/bin/cut -c2`"
if test -f "$FILE"
then
if test "$RES" = "f"
then
RES=""
else
RES="-s"
fi
/usr/bin/g3topbm $RES $FILE | /usr/bin/pnmtopng | \
/usr/bin/makemime -c "image/png" -e "base64" \
-N "Page $PAGENUM" \
-a "Content-Disposition: attachment; filename=\"page$PAGENUM.png\"" -
else
echo "ERROR: $FILE - not found" | makemime -c "text/plain" -e "quoted-printable" -
fi
PAGENUM=`expr $PAGENUM + 1`
shift
done
echo ""
echo "--courierfax--"
}
makemessage "$@" | $sbindir/sendmail -f "$MAILFROM" "$RCPTTO"
if test $? = 0
then
if test "$DODELETE" = 1
then
shift 3
while test $# -gt 0
do
rm -f "$1"
shift
done
fi
fi
|