<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Julian Jurai</title>
    <description>The latest articles on DEV Community by Julian Jurai (@julianjurai).</description>
    <link>https://dev.to/julianjurai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F111749%2Fe4bf66a9-3553-4d63-8c18-01eb8fd607b7.png</url>
      <title>DEV Community: Julian Jurai</title>
      <link>https://dev.to/julianjurai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/julianjurai"/>
    <language>en</language>
    <item>
      <title>Getting Started with Cloudflare Pages, Google domains and Gmail</title>
      <dc:creator>Julian Jurai</dc:creator>
      <pubDate>Wed, 12 May 2021 14:24:16 +0000</pubDate>
      <link>https://dev.to/julianjurai/getting-started-with-cloudflare-pages-google-domains-and-gmail-fhf</link>
      <guid>https://dev.to/julianjurai/getting-started-with-cloudflare-pages-google-domains-and-gmail-fhf</guid>
      <description>&lt;p&gt;&lt;em&gt;Last updated: May 12th 2021&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What's Covered
&lt;/h1&gt;

&lt;p&gt;This post will walk you through how to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Deploy a static site to Cloudflare pages&lt;/li&gt;
&lt;li&gt;Setup a custom domain using &lt;a href="https://domains.google.com/" rel="noopener noreferrer"&gt;Google D omains&lt;/a&gt; for your static site&lt;/li&gt;
&lt;li&gt;Send and receive emails using your custom domain&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Problem using Cloudflare Pages and Google Domains
&lt;/h1&gt;

&lt;p&gt;Most domain registrars (such as &lt;a href="https://domains.google.com/" rel="noopener noreferrer"&gt;Google Domains&lt;/a&gt;) offer email forwarding services out of the box. &lt;/p&gt;

&lt;p&gt;The problem encountered was that in order to use a custom domain for a site deployed to Cloudflare Pages you're &lt;a href="https://developers.cloudflare.com/pages/getting-started#adding-a-custom-domain" rel="noopener noreferrer"&gt;required&lt;/a&gt; to switch nameservers. You have to use Cloudflare's nameservers as opposed to the domain registrar's nameservers. This breaks some domain level settings including email forwarding configurations when using &lt;a href="https://domains.google.com/" rel="noopener noreferrer"&gt;Google Domains&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Let's get into it
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Deploy a static site to Cloudflare pages
&lt;/h2&gt;

&lt;p&gt;I'm going to assume you already have a repo with a static site. If not fork &lt;a href="https://github.com/Julian-Jurai/simple-static-site" rel="noopener noreferrer"&gt;this repository&lt;/a&gt;. It's some barebones HTML.&lt;/p&gt;

&lt;p&gt;You'll need to &lt;a href="https://pages.cloudflare.com/" rel="noopener noreferrer"&gt;sign up&lt;/a&gt; for Cloudflare pages then connect your Github account.&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Start Project&lt;/strong&gt;, select the repository you which to build and deploy. Continue along the setup then you'll see your app getting deployed and finally success message. &lt;/p&gt;

&lt;p&gt;You should now have something that resembles:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgoubongw5khkj25l95r9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgoubongw5khkj25l95r9.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Setup a custom domain using &lt;a href="https://domains.google.com/" rel="noopener noreferrer"&gt;Google Domains&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Picking up from the last step the &lt;strong&gt;Visit Link&lt;/strong&gt; link takes you to a url that looks like &lt;code&gt;simple-static-site.pages.dev&lt;/code&gt;. Note the &lt;code&gt;page.dev&lt;/code&gt; domain name. We're going to change that in this step to use your custom domain.&lt;/p&gt;

&lt;p&gt;I'm going to assume you already have a custom domain if not get one at &lt;a href="https://domains.google.com/" rel="noopener noreferrer"&gt;Google Domains&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Select the site you deployed from the Cloudflare Pages dashboard and go to &lt;strong&gt;Custom Domains&lt;/strong&gt; then &lt;strong&gt;Set up a Custom Domain&lt;/strong&gt;. Enter the you custom domain as it appears on your domain registrar's site (e.g. oldgrandpappy.com).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fza6r1lle846jjx8tfe3u.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fza6r1lle846jjx8tfe3u.gif" alt="cf_t1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This should prompt you to &lt;strong&gt;Begin DNS transfer&lt;/strong&gt;. Continue by clicking the big blue button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg16rdqy8bbzhhvr7okh9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg16rdqy8bbzhhvr7okh9.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll get redirected and you may have to resubmit the domain name and choose a plan. Select the Free Tier plan at the bottom and hit continue. &lt;/p&gt;

&lt;p&gt;Complete the setup steps and you'll reach a point where its asking you to &lt;strong&gt;Replace with Cloudflare's nameservers&lt;/strong&gt;. Let's do that now.&lt;/p&gt;

&lt;p&gt;Head over to &lt;a href="https://domains.google.com/" rel="noopener noreferrer"&gt;Google Domains&lt;/a&gt; &lt;strong&gt;DNS&lt;/strong&gt; settings and set the custom name servers. There should be at least two provided by Cloudflare. It should like the image below when added.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpe3vnb8fld87wiidna8c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpe3vnb8fld87wiidna8c.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the domain name servers are replaced with Cloudflare's name server's it will probably take a while before it registers. In my experience it happens within 5 minutes though it could be longer.&lt;/p&gt;

&lt;p&gt;Once its completed you should see an indication of the change under the DNS settings in Cloudflare dashboard.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftuxnp9aydku45z1nu04b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftuxnp9aydku45z1nu04b.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Head on back to the deployed Page from the Cloudflare Pages dashboard and click on &lt;strong&gt;Custom Domains&lt;/strong&gt; once more. Enter your custom domain. You should see your custom domain appear with a prompt to &lt;strong&gt;Activate Domain&lt;/strong&gt;. This would insert the appropriate CNAME record for your root domain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffbqg9wnxrqe6sgtqkzxy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffbqg9wnxrqe6sgtqkzxy.gif" alt="cf_t2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give it about 10 minutes then you should see in the &lt;strong&gt;Custom Domains&lt;/strong&gt; section an indication that you domain is active. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwtj29ndu2cez9vncfkji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwtj29ndu2cez9vncfkji.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should be able access your static site using the custom domain at this point. &lt;/p&gt;

&lt;h2&gt;
  
  
  3. Send and receive emails using your custom domain
&lt;/h2&gt;

&lt;p&gt;We'll be using &lt;a href="https://improvmx.com/" rel="noopener noreferrer"&gt;Improvmx.com&lt;/a&gt; as our email forwarding service. &lt;/p&gt;

&lt;p&gt;Go to &lt;a href="https://improvmx.com/" rel="noopener noreferrer"&gt;Improvmx.com&lt;/a&gt; and setup your alias. Notice I added an alias with a username below (the &lt;code&gt;hey&lt;/code&gt; in &lt;code&gt;hey@oldgrandpappy.com&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdgj0m9az0q9676eeoabf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdgj0m9az0q9676eeoabf.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, go to &lt;strong&gt;DNS Settings&lt;/strong&gt; and add the &lt;code&gt;MX&lt;/code&gt; and &lt;code&gt;TXT&lt;/code&gt; records to Cloudflare's DNS Settings.&lt;/p&gt;

&lt;p&gt;It should look similar to this when you're done.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl35xi44eapuvlwwcflfm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl35xi44eapuvlwwcflfm.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fonj558iisrk3vwks50jp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fonj558iisrk3vwks50jp.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point you should be able to &lt;strong&gt;receive&lt;/strong&gt; emails sent to your alias.&lt;/p&gt;

&lt;p&gt;To be able to send emails from the alias we'll need to set up our SMTP Credentials. &lt;a href="https://improvmx.com/" rel="noopener noreferrer"&gt;Improvmx.com&lt;/a&gt; offers a really easy way to do this but it requires payment. &lt;/p&gt;

&lt;p&gt;We can also do this with Gmail for free!&lt;/p&gt;

&lt;p&gt;To use Gmail, we'll first need to make a modification to your Google accounts security policy. There are two routes you can take. Either &lt;a href="https://support.google.com/accounts/answer/6010255#zippy=%2Cuse-an-app-password%2Cif-less-secure-app-access-is-off-for-your-account" rel="noopener noreferrer"&gt;allowing access to less secure apps&lt;/a&gt; or using an &lt;a href="https://www.google.com/landing/2step/" rel="noopener noreferrer"&gt;App Password&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Once you update the security policy go to Gmail:&lt;br&gt;
Settings -&amp;gt;  Accounts and Imports -&amp;gt; Send mail as -&amp;gt; Add another email address&lt;/p&gt;

&lt;p&gt;Enter the alias you'd like to use to send emails from. Ensure &lt;strong&gt;"treat as alias"&lt;/strong&gt; is unchecked.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzb58ajm1l485c80v74u8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzb58ajm1l485c80v74u8.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hit next and enter the SMTP credentials for you gmail account. This will be your email and password for gmail. If &lt;a href="https://www.google.com/landing/2step/" rel="noopener noreferrer"&gt;app password security&lt;/a&gt; is used, the generated password should be used instead of your password. Ensure the &lt;strong&gt;SMTP Server&lt;/strong&gt; is set to &lt;code&gt;smtp.gmail.com&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkom167uaw26j4ltxfudo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkom167uaw26j4ltxfudo.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsev2tlhejoctsdmc1ty.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsev2tlhejoctsdmc1ty.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll receive an email with a confirmation code to enter. Enter the code and thats it!&lt;/p&gt;

&lt;p&gt;You should now be able to select a &lt;code&gt;From&lt;/code&gt; alias when sending an email. &lt;/p&gt;

&lt;p&gt;Thats it!&lt;/p&gt;

&lt;p&gt;Hope this was helpful.&lt;/p&gt;

&lt;p&gt;Also oldgrandpappy.com is back on the market.&lt;/p&gt;

</description>
      <category>gmail</category>
      <category>cloudflarepages</category>
      <category>customdomains</category>
      <category>googledomains</category>
    </item>
  </channel>
</rss>
