Getting Started with DeliverHQ
This week I have been setting up our internal CRM to use DeliverHQ mail service. I thought I’d chronicle the steps I had to take to set it up, as the help wasn’t all that great. (Note: I set this up on a CF server, but the web calls would be the same in any language).
Step 1: Set Up Domains.
First you need to authenticate the domain you want to send email from, you do this in the ‘Domain’ tab at the top left (Highlighted in the following image). You’ll click on “Create Domain“, enter in your domain name, click submit, then back on the pictured screen click on the “UNVERIFIED” link. This will cause the red text at the top to be displayed, this text gives you the details you need to give to your domain host. I just copied the entire red coloured text and sent it to them. Once they say it has been added just click on UNVERIFIED again, A green message should appear at the top in place of the red one stating that you are now verified. Once you have done this you are allowed to use the smtp settings that we will set up next. (NOTE: if you are sending everything via the API you do not need to do this step).
Step 2: Setting Up Mail Server.
There are 2 ways you can send emails, the first is using smtp settings, the second is HTTP POST calls to their API. To do either you have to set up a virtual MailServer. Click on Servers in the top right and then click on the big Green “Create New Virtual Mail Server” button on the left. In the next screen give your sever a name and hit “Create Server” – the rest are optional if you want to use them.
Step 3: Sending and receiving Mail.
Once you have created a Virtual Mail Server and opened it, you should be greeted with the following screen. I’ll leave you to explore the other stats that are available and instead focus on 2 pages; Mailboxes and Server Setup.
If you intend on only sending mail via smtp, then you will be interested in the Server Setup tab. Use the API UID as the username and the API Key as the password then you’re all setup to send! A quick note on the From field – you have to have registered a domain (step 1) to use it in a from address, e.g. sending from email@example.com would require me to authenticate sdevgame.com in step 1.
If you want to send emails VIA HTTP post, look no further than their Send API page.
The real awesome part of the application comes in the form of receiving emails via HTTP post calls. First we would need to setup a virtual Mailbox in the Mailboxes tab. Doing this is fairly simple, just enter in the name for the mailbox, the address (if you are receiving email via the smtp server – this requires setup of MX records to direct mail to the DeliverHQ smtp server) and what to do with the email when it is received. The address is optional as you can just forward emails from an externally hosted email account to the unique deliverHQ email account that is shown once you have created the Mailbox. The rest of the work is up to you on your server, check out their Receive API page for more details on the data received from the HTTP call.
Some additional notes on the Receive API that they haven’t had mentioned is the attachments array, it’s format is as follows: [[“file name”,”image-type”,(some numeric identifier),”URL to download from the deliverHQ server”,”cid number, if it’s embedded”]], an example is: [[“small_pic.png”,”image/png”,16526,”https://something.deliverhq.com/blah/file/0″%5D%5D