Earlier I searched the forum to setup DKIM & SPF to allow my server to send e-mails to gmail, hotmail and other 'mainstream' e-mail services without my e-mails appearing in the users spam folder.
After searching for a while, I thought I'd give back and describe what I did to hopefully make it easier for you guys to send e-mails from your own servers without them being filtered as spam.
For this, you'll need access to your domain's dns settings. My provider is GoDaddy.
Domain Setup:
Step 1) Head over to https://www.sparkpost.com/resources/tools/dkim-wizard
Step 2) Enter your servers domain name in the first field (Described as Domain name of the “From:” header address, not the SMTP “MAIL FROM”. (e.g., port25.com))
Step 3) Enter a selector name (we'll need this later) - I used the simple 'dkim' as selector.
Step 4) Press Create Keys at the bottom.
Step 5) Scroll down the page after the keys have been created to "Step 1"
Step 6) Copy and paste "k=rsa\; p=..." from the "Step 1"
Just before Step 1 on port25's site, there is a block which starts with "-----BEGIN RSA PRIVATE KEY-----"
Be sure to copy that, the whole thing. So your copy should start with "-----BEGIN RSA PRIVATE KEY-----" and end with "-----END RSA PRIVATE KEY-----"
Create a new file that we can reference later, I've called mine "dkim.htrcloud.co.uk" and it's extensions has to be PEM (.pem)
Step 7) Head over to DNS settings of your domain.
Step 8| Create a new TXT record, enter [SELECTOR]._domainkey into the host field. [selector] should be replaced with the selector you wrote into step 3.
Step 9) In the value field, enter "v=[SELECTOR]; t=s;" then enter the copied text from Step 6. Some Domain Servers allow non-alphanumeric characters in these fields, however godaddy doesn't. So be sure to remove the quotes and any backslashes from the copied text from Step 6.
Be sure to replace [SELECTOR] in both Step 8 & 9 with the selector you used earlier in Step 3.
Step 10) Save that record, then head over to https://www.spfwizard.net/
Step 11) This is quite self-explanatory. Firstly enter your domain into the first field called "Your Domain"
Step 12) Set the appropriate settings, my settings you can see in the images below.
Step 13) You will see above the form a block labeled "The DNS entry (copy and paste this)" - do exactly what that says, copy between the quotes "v=spf1 ..."
Step 14) Head back over to your dns settings, add another TXT field. The host name in this record should be your domain name, (for me I can use @ as this sends it to my domain anyway with GoDaddy).
Step 15) In the Value field, paste exactly what we copied in Step 13.
Step 16) Save your DNS file and all is good domain side.
hMailServer Setup:
Step 1) Open hMailServer Administrator and select your domain under "Domains"
Step 2) On the right side, select DKIM Signing.
Step 3) Check Enabled
Step 4) Enter the location of that PEM file we made earlier.
Step 5) Enter the selector we specified earlier (From Step 3)
Step 6) Header method should be relaxed
Step 7) Body method should be relaxed
Step 8| Signing algorithm should be SHA256
If you followed these steps exactly, you should be able to send e-mails to hotmail / gmail without them being filtered as spam!
Here's some reference screenshots below. Please note that some dns servers can take up to 24/48 hours to update if I remember correctly so be patient. To check these settings have worked, you can send an email to: check-auth@verifier.post25.com <-- They will send an automatic e-mail back with your e-mails full details.
See "Auth Report" below for a report example from my own e-mail server after sending a blank e-mail to check-auth.
Step 1 to Step 4 - Enter domain & selector

Step 6 - Copy public key for dns

Step 8 to Step 9 - Enter public key into dns

Step 10 to Step 13 - SPF settings

hMail Step 1 - Open and navigate to DKIM

Response from Check-Auth
