3 changed files with 60 additions and 1 deletions
@ -1,3 +1,21 @@ |
|||
# 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 |
|||
|
|||
@ -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 |
|||
@ -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…
Reference in new issue