# Getting the DKIM to work with Cloudflare

**URL:** https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752
**Category:** Self-hosting
**Tags:** email
**Created:** [October 25, 2017, 11:35am UTC](https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752 "2017-10-25T11:35:54Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![rohitink](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rohitink/32/81101_2.png) [@rohitink](https://meta.discourse.org/u/rohitink)
#### Post date: [October 25, 2017, 11:35am UTC](https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752/1 "2017-10-25T11:35:54Z")

</div>

Hello,

I have successfully installed Discourse.

My Primary site is hosted on a cPanel VPS somewhere else.  
While my [forum.mysite.com](http://forum.mysite.com) is hosted on a Linode Cloud VPS.  
And my DNS is managed by CloudFlare.

I have successfully configured the DMARC & SPF. But I don’t know how to get the public key to add in DKIM txt record. Where do I get this public key from?

Thanks.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 25, 2017, 11:38am UTC](https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752/2 "2017-10-25T11:38:45Z")

</div>

Your mail delivery service should tell you.

---

<div class="post-metadata">

### Author: ![rohitink](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rohitink/32/81101_2.png) [@rohitink](https://meta.discourse.org/u/rohitink)
#### Post date: [October 25, 2017, 11:46am UTC](https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752/3 "2017-10-25T11:46:02Z")

</div>

Yes. I am confused. Who will be my Mail delivery service here?  
SMTP Details I have provided are those of my VPS’ cPanel. So should i fetch the DKIM public key from there?

But there is no subdomain [forum.mysite.com](http://forum.mysite.com) in my cPanel. Will that be a problem?  
As **`forum`** is an A record in my cloudflare pointing to linode’s IP

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 25, 2017, 11:52am UTC](https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752/4 "2017-10-25T11:52:29Z")

</div>

Got should Google dkim for more information.

By default discourse will send from the discourse host name. You can edit a line near the end of app.yml to change it.

If your cpanel will allow remote hosts to deliver mail from a remote ip with a username and password it might work. Discourse doesn’t really care if your can dkim or spf records ;it’s just a way to see that your mail isn’t classified as spam.

---

<div class="post-metadata">

### Author: ![rohitink](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rohitink/32/81101_2.png) [@rohitink](https://meta.discourse.org/u/rohitink)
#### Post date: [October 25, 2017, 11:56am UTC](https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752/5 "2017-10-25T11:56:54Z")

</div>

Yes, the cPanel allows sending of emails from different servers. The emails are being sent successfully.  
Everything is correctly configured now. SPF, DMARC, etc.

Only DKIM keys seem to be a problem. I did google a lot. But its confusing.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [December 6, 2019, 12:25am UTC](https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752/6 "2019-12-06T00:25:51Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [September 14, 2023, 9:31am UTC](https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752/7 "2023-09-14T09:31:29Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [September 14, 2023, 9:50am UTC](https://meta.discourse.org/t/getting-the-dkim-to-work-with-cloudflare/72752/8 "2023-09-14T09:50:39Z")

</div>


