Browse Source

Upload files to ''

master
Joshua Pickard 5 years ago
parent
commit
7bc50d1580
  1. 20
      README.md
  2. 13
      faxtoemail.service
  3. 28
      faxtoemail.sh

20
README.md

@ -1,3 +1,21 @@
# hylafaxtoemail # hylafaxtoemail
Send faxes received from HylaFAX to an email address as PDFs
Send faxes received from HylaFAX to an email address as PDFs. sudo apt-get install sendemail libio-socket-ssl-perl libnet-ssleay-perl
git clone https://github.com/signal-9/hylafaxtoemail.git
cd hylafaxtoemail
Edit `faxtoemail.sh` and fix your SMTP settings, directories, etc.
Edit `faxtoemail.service` and adjust your username accordingly.
chmod +x faxtoemail.sh
sudo cp faxtoemail.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable faxtoemail.service
systemctl start faxtoemail
To automatically remove converted PDFs older than 7 days, add to your crontab:
0 0 * * 0 find /your/pdf/directory/here/* -mtime +6 -type f -delete >/dev/null 2>&1

13
faxtoemail.service

@ -0,0 +1,13 @@
[Unit]
Description=Fax to Email Script
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
ExecStart=/home/username/hylafaxtoemail/faxtoemail.sh
[Install]
WantedBy=multi-user.target

28
faxtoemail.sh

@ -0,0 +1,28 @@
#!/bin/bash
# HylaFAX recieved directory
TARGET=/var/spool/hylafax/recvq
# Directory you will have converted pdfs stored
PROCESSED=/home/username/pdfs
# Edit your SMTP server info as needed
SMTPFROM=user@email.org
SMTPTO=user2@email.org
SMTPSERVER=mail.email.org:587
SMTPUSER=user@email.org
SMTPPASS=mysupersecurepassword
MESSAGEBODY="New Fax Recieved. Say whatever you want here."
SUBJECT="New Fax, or something"
# Watch the target directory for new files, wait 5
# minutes (about 20 pages worth), then convert to pdf and email the file.
inotifywait -m -e create --format "%f" $TARGET \
| while read FILENAME
do
echo Detected $FILENAME, converting to pdf and emailing
sleep 5m
tiff2pdf -o "$PROCESSED/$FILENAME.pdf" "$TARGET/$FILENAME"
wait
sleep 10s
sendEmail -f $SMTPFROM -t $SMTPTO -u $SUBJECT -m $MESSAGEBODY -s $SMTPSERVER -xu $SMTPUSER -xp $SMTPPASS -a "$PROCESSED/$FILENAME.pdf"
done
Loading…
Cancel
Save