Send faxes with Phaxio using 3rd party email services. Mailphax is a simple sinatra app. You can run it on any host or with any service that supports ruby and sinatra.
Use the deploy button
Or do it yourself
(This assumes you have the Heroku toolbelt installed and have a Heroku account.)
- git clone this repo && cd mailphax
- heroku create
- heroku config:set PHAXIO_KEY=yourPhaxioApiKey
- heroku config:set PHAXIO_SECRET=yourPhaxioApiSecret
- git push heroku master
Now set up your hosted email service to invoke callbacks to this service when mail is received. (See below.)
- Sign up for a mailgun account
- In the Mailgun console, click "Domains" in the navbar.
- Add a new inbound domain that you have DNS control over. (Or use something.mailgun.org and you can use a mailgun subdomain! If you use a mailgun subdomain, you can skip the next step as DNS is set up by mailgun already.)
- Modify the DNS on your inbound domain to point to Mailgun using MX records.
- Click "Routes" in the main Mailgun Navbar.
- Click "Create new route"
- Leave the priority field alone.
- For "filter expression", specify "match_recipient("[0-9]+@YOURDOMAIN")" where YOURDOMAIN is the domain you added in step 3.
- For "Actions" specify "forward("http://yourMailPhaxInstallation/mailgun")" where yourMailPhaxInstallation should be the location where you've installed the sinatra app.
- Click "Save".
- Profit.
- Sign up for a mandrill account
- In the Mandrill console, click "Inbound" in the left sidebar.
- Add a new inbound domain that you have DNS control over.
- Modify the DNS on your inbound domain to point to Mandrill using MX records. (Click the "DNS Settings" button for more info.)
- Click "Routes" in the Mandrill console under your new inbound domain.
- Add a wildcard route "*" and point it to http://yourMailPhaxInstallation/mandrill (e.g. http://example.com/mandrill)
- Profit.
TODO
- Support SendGrid
- Reply to user with confirmation of fax success/failure
- Reply to user if fax submission failed (e.g. bad number, no attachment)
- Allow filtering inbound emails by regexes