Skip to content

Instantly share code, notes, and snippets.

@derjohn
Created September 24, 2020 10:56
Show Gist options
  • Save derjohn/81648c71fad243908913182e9a63aab9 to your computer and use it in GitHub Desktop.
Save derjohn/81648c71fad243908913182e9a63aab9 to your computer and use it in GitHub Desktop.
E-Mail to Fax Gateway with a DUS.net account
# Goal: Send an PDF Attachment to an catchall E-Mail Adresss with the fax number LHS
# like +49123456778@myfax.example.com and have it processes as a Fax message.
# You need: an dus.net account and the crypto token for the subject-line-auth
# an catchall e-mail account like *@myfax.example.com with an own homedirectory
# This script will rewrite the e-mail target and subject and forward it to DUS.net.
1) Create a <USERHOME>/.procmailrc
LOGFILE=procmail-for-fax.log
VERBOSE=YES
:0 wf
* ^To:.*@myfax.example.com
|<USERHOME>/bin/faxtomail.sh
:0c
* !^FROM_MAILER
! faxversand@fax.dus.net
2.) Create <USERHOME>/bin/faxtomail.sh
#!/bin/sh
echo "$(date +%F%-H:%M)" >> /tmp/faxtomail.log
# Replace To-Line
cat - \
| sed -e 's/To:.*[<\ ]\(.*\)@\(.*\)$/To: \1@fax.dus.net/' \
| sed -e 's/Subject: \(.*\)$/Subject: XY12345:*ACDEFG12345YOURDUSNETTOKEN/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment