GUIDE: DKIM & SFP Setup - Gmail UNSPAM

This section contains user-submitted tutorials.
Post Reply
HarryR
New user
New user
Posts: 3
Joined: 2018-02-24 23:12
Location: Weymouth, UK
Contact:

GUIDE: DKIM & SFP Setup - Gmail UNSPAM

Post by HarryR » 2018-02-24 23:58

Hello!

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.port25.com/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
Image

Step 6 - Copy public key for dns
Image

Step 8 to Step 9 - Enter public key into dns
Image

Step 10 to Step 13 - SPF settings
Image

hMail Step 1 - Open and navigate to DKIM
Image

Response from Check-Auth
Image
Web developer for cinema and alcohol chains across the world.
My own site can be found at https://htrcloud.co.uk

User avatar
jimimaseye
Moderator
Moderator
Posts: 8175
Joined: 2011-09-08 17:48

Re: GUIDE: DKIM & SFP Setup - Gmail UNSPAM

Post by jimimaseye » 2018-02-25 00:06

Thanks Harry. I've moved this to the TUTORIALS section.
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

HarryR
New user
New user
Posts: 3
Joined: 2018-02-24 23:12
Location: Weymouth, UK
Contact:

Re: GUIDE: DKIM & SFP Setup - Gmail UNSPAM

Post by HarryR » 2018-02-25 11:29

Thank you, I soon realized after that there was a user submitted tutorials form and felt a bit silly! :lol: :lol:
Web developer for cinema and alcohol chains across the world.
My own site can be found at https://htrcloud.co.uk

palinka
Senior user
Senior user
Posts: 1302
Joined: 2017-09-12 17:57

Re: GUIDE: DKIM & SFP Setup - Gmail UNSPAM

Post by palinka » 2018-03-17 15:19

HarryR wrote:
2018-02-24 23:58

Response from Check-Auth
Image
Your check auth email is still marked as spam. I suspect you may have sent the email with a blank body and/or blank subject. Put anything in both subject and body (even just "hi") and you should not be marked as spam. This is important, I think, because if you do this and it still gets marked as spam, you should investigate further as to why because port25 will certainly not be the only one marking you as spam.

The valid response should be:

Spamassassin check: ham

HarryR
New user
New user
Posts: 3
Joined: 2018-02-24 23:12
Location: Weymouth, UK
Contact:

Re: GUIDE: DKIM & SFP Setup - Gmail UNSPAM

Post by HarryR » 2018-07-29 20:35

palinka wrote:
2018-03-17 15:19
HarryR wrote:
2018-02-24 23:58

Response from Check-Auth
Image
Your check auth email is still marked as spam. I suspect you may have sent the email with a blank body and/or blank subject. Put anything in both subject and body (even just "hi") and you should not be marked as spam. This is important, I think, because if you do this and it still gets marked as spam, you should investigate further as to why because port25 will certainly not be the only one marking you as spam.

The valid response should be:

Spamassassin check: ham
I did notice that after I made this, but you are correct - I send the email with a blank body. I did however do another test which passed all of the criteria, but thank you for pointing that out! :)
Web developer for cinema and alcohol chains across the world.
My own site can be found at https://htrcloud.co.uk

vers
New user
New user
Posts: 2
Joined: 2018-08-11 18:45

Re: GUIDE: DKIM & SFP Setup - Gmail UNSPAM

Post by vers » 2018-08-11 18:52

Step 8 and 9 from instruction:
HarryR wrote:
2018-02-24 23:58
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.
don't match the image:
HarryR wrote:
2018-02-24 23:58
Step 8 to Step 9 - Enter public key into dns
Image
I think the "v" parameter in the step 9 shouldn't be set to "[SELECTOR]". Instead it should be "DKIM1".

vers
New user
New user
Posts: 2
Joined: 2018-08-11 18:45

Re: GUIDE: DKIM & SFP Setup - Gmail UNSPAM

Post by vers » 2018-08-11 19:23

HarryR wrote:
2018-02-24 23:58
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.
This is also incorrect. The correct address is check-auth@verifier.port25.com.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8175
Joined: 2011-09-08 17:48

Re: GUIDE: DKIM & SFP Setup - Gmail UNSPAM

Post by jimimaseye » 2018-08-11 20:05

If problems are encountered other setup instructions for dkim can be found here viewtopic.php?f=21&t=29402. Note the warning of using 2048 bit keys.
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

davidsmith1989
New user
New user
Posts: 1
Joined: 2018-09-10 11:29
Contact:

Re: GUIDE: DKIM & SFP Setup - Gmail UNSPAM

Post by davidsmith1989 » 2018-09-25 13:15

Very precise and autonomous guide thanks you helped me alot keep it up..

Post Reply