Due to a recent printing fail, I’ve found myself without any business cards and I’m about to head out to How To Web in Bucharest for 3 days where I’m certain I’ll meet a few folks who ask for my details.
Luckily, I work for a company that makes sending and receiving emails from an application easy, so I whipped up this quick app using SendGrid and Heroku to give me a quick autoresponder on my vanity email address that will send a digital version of my business card out to whomever emails that address. It’s quick to turn around and gets my details direct to their inbox.
Start by cloning the repository:
git clone https://github.com/martyndavies/ohcardless.git
Then follow these instructions at the Heroku command line from inside the ohcardless directory:
heroku addons:add sendgrid:starter
heroku config:set FROM_ADDRESS="firstname.lastname@example.org"
heroku config:set FROM_NAME="Martyn Davies (SendGrid)"
heroku config:set SUBJECT="My business card"
heroku config:set TWITTER="@martynd"
heroku config:set SIGN_OFF="Nice meeting you!"
heroku config:set SIGNATURE="MD"
heroku config:set CARD_IMAGE_URL="https://dl.dropboxusercontent.com/u/5857478/mycards/businesscard-back.png"
As you can see above, most of these settings are pieces of the email that gets sent out. If you want to strip this bit out and hardcode your settings then you can do so.
This app supports text and HTML emails, the CARD_IMAGE_URL is used in the HTML email and can be any type of graphic (PNG is recommended), just don’t make it too big (hey, maybe the size of an actual business card?). I used a copy of the proof I got from the printer for mine.
Set up SendGrid
Do the following to set up SendGrid so your newly deployed to Heroku app can receive emails and send them out properly:
- Add an MX record to the domain you want to use for this app and set it to ‘mx.sendgrid.net’
- Wait up to 24 hours depending on your DNS provider… 🙁
- Log into SendGrid – Your credentials can be found by running
- When you log in you’ll be asked a few questions to set up your account, say “no” to them, for this project you don’t need them.
- Click on “Global Settings” and tick the box for ‘Don’t convert plain text emails to HTML’, then hit Update.
- Change your Inbound Parse Webhook settings*
- Send an email to email@example.com and see what comes back!
* Your hostname is the one you added the MX record to, and your URL takes this format: http://your_heroku_address.herokuapp.com/receiver
This app uses the SendGrid Starter add-on that has a hard limit of 200 emails per day. If you think you’ll go over this, you’re an awesome networker and should probably think about remembering your cards.
I used the SendGrid NodeJS helper library for this app, but the way the app works will translate to any language using any of our excellently maintained libraries that you can find on our GitHub account.
How could you extend this?
I built this to solve a short-term problem for myself and it’ll get used either when I forget my cards, or I’ve run out, or at any point where someone asks for my details and they’ve got a device for sending emails handy. However, this app could be extended to store inbound requests so you see who asked for your details and got a copy of your card.
Take that one step further and have the app look at your Foursquare check-in history. If you’re a check-in addict like myself, you’ll be able to grab the latest check-in stored on your account at the time a business card request comes in and store that alongside the requester’s name and email address. This way when you look back, you’ll be able to associate events with particular people.
From one inbound email, let creativity commence!