R
Railway•10mo ago
keithb0226

How to enable Email on Cloudflare

I have a React/NodeJS app running on Railway using a custom domain. Cloudflare DNS records have been added (CNAME) and deleted (root A record) to enable Cloudflare to proxy traffic to my site on Railway. This is working great but I now have no email. The MX record on Cloudflare points to the domain wuther.au but because I removed the A record, this doesn't seem to work any more. This must be a common issue but I can't find any solutions. Does anyone here know how I might get my email working in this context? Thanks.
25 Replies
Percy
Percy•10mo ago
Project ID: 06d0b2d6-0840-4e62-be7a-b060932f11e4
keithb0226
keithb0226•10mo ago
06d0b2d6-0840-4e62-be7a-b060932f11e4
Brody
Brody•10mo ago
i dont know what email servers you use, but i use zoho and my mx records point to mx.zoho.com you would want to point your mx records to the mx values your email provider uses
keithb0226
keithb0226•10mo ago
Hi @Brody. Mine do but I think because I removed the A record that points to the same domain, email routing no longer works. Does that make sense?
No description
Brody
Brody•10mo ago
who's your email provider?
keithb0226
keithb0226•10mo ago
Hostgator Cpanel account.
Brody
Brody•10mo ago
do you host your own email on a hostgator server?
keithb0226
keithb0226•10mo ago
Yes
Brody
Brody•10mo ago
https://www.hostgator.com/help/article/mail-exchange-record-what-to-put-for-your-mx-record#scenario2 i assume you would just set the mail.wuther.au record to the ip of your cpanel host
keithb0226
keithb0226•10mo ago
Thanks, I'll check it out... Quick question... Do I make these changes at my domain registrar (i.e. where the nameservers point to Cloudflare)?
Brody
Brody•10mo ago
no youd make them in cloudflare
keithb0226
keithb0226•10mo ago
I am not able to complete step 1 - add an A record. I get this message: "A CNAME record with that host already exists. "
Brody
Brody•10mo ago
so then update the already existing record
keithb0226
keithb0226•10mo ago
Do you mean the CNAME that points to Railway? Sorry, I'm not very knowledgeable on this stuff.
Brody
Brody•10mo ago
^
keithb0226
keithb0226•10mo ago
Oh, I understand now. I''l try that, thanks.
keithb0226
keithb0226•10mo ago
I get an error message: "Change the content of your MX record to be a hostname (and not an IP address)." https://developers.cloudflare.com/dns/manage-dns-records/how-to/email-records/#add-mx-records
Set up email records · Cloudflare DNS docs
There are two reasons to set up email records for your domain: to make sure email reaches your mail server and to prevent other email senders from …
Brody
Brody•10mo ago
yes so set mail.wuther.au to an a record, then set your mx record to mail.wuther.au
keithb0226
keithb0226•10mo ago
I can't seem to create an A record when the CNAME already exists on that domain. If I remove the CNAME, create the A Record it will work for email but then my app on Railway will not display.
Brody
Brody•10mo ago
i am not saying to set an A record on the root domain, i am saying to set an A record for the mail subdomain
keithb0226
keithb0226•10mo ago
@Brody, you're a genius. Saved me a lot of time, thanks! I'm receiving email in my hostgator email account. Now I'll figure out how to connect via an email client as it's referencing mail.wuther.au. Cheers!
Brody
Brody•10mo ago
awesome! hostgator had tutorials for that stuff too btw, don't currently have the links on hand though
keithb0226
keithb0226•10mo ago
I'll find it, thanks!
Brody
Brody•10mo ago
you're supposed to use that to mark the answer 🤣
keithb0226
keithb0226•10mo ago
OOPS!