Setting up cPanel email from LAMP hosting with Zeit's Now



I've been using Zeit's Now for some projects recently because Netlify can't handle NodeJS SSR (and Heroku works, but not as effortlessly as Now). I recently had to combine this new hosting platform with a more antiquated LAMP server running cPanel for email.

One of my clients is currently in the process up updating their website from Wordpress to a NextJS frontend backed with a Laravel API. Regardless of this, they currently use cPanel to handle their Wordpress install, which also handles their company emails. And since the budget is particularly tight on the project, rather than migrate to a paid service (or even something free like Zoho), we opted to keep the server with cPanel and use it for the Laravel API.

However, since the API is a subdomain and not the primary server, I had to reconfigure the DNS to make the NextJS frontend the primary domain, and the API as a subdomain. By doing this, I also had to setup DNS records for the mail server, since they were automatically generated by the DNS before.

⚙️ The Process

  1. Go to cPanel > Domains > Zone Editor.

  2. Click Manage next to the domain your want to use.

  3. Click the MX button under the Filter: section.

  4. If you don't have an MX record:

In cPanel, create a new MX record with the value and the priority 0.

If you have an MX record already:

Create a new MX record on Zeit using their CLI now dns add @ MX 10.

  1. Create additional DNS records on Zeit:

Type: A | Name: mail | IP address: cPanel IP | Automatic TTL
Type: A | Name: webmail | IP address: cPanel IP | Automatic TTL
Type: A | Name: autodiscover | IP address: cPanel IP | Automatic TTL
Type: TXT | Name: @ | Content: v=SFP_value...| Automatic TTL

You can find your cPanel IP in the cPanel homepage/dashboard in the sidebar under GENERAL INFORMATION and Dedicated IP Address.

It was fairly simple, but it was such a specific process, I thought I'd signal boost it here to ensure no one struggles with it.