Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP
Tags: howto, nocode, selfhosting
Published: 2023-09-30 11:42:03

---
title: Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP
published: true
date: 2023-09-30 11:42:03 UTC
tags: HowTo #nocode #selfhosting
canonical_url: 
---

 ![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-contact-gmail-smtp-noted.lol.jpg)

There's plenty of 3rd party contact forms out there that you can use. Some are free and others are paid options. Have you ever considered using a open source, self-hosted option? Today I'll show you exactly how you can do just that.

### What is NocoDB?

> Turns any MySQL, PostgreSQL, SQL Server, SQLite & MariaDB into a smart spreadsheet. The open source Airtable alternative.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://github-readme-stats.vercel.app/api/pin/?username=nocodb&repo=nocodb&theme=midnight-purple&hide_border=true)

This project is a little obscure for NocoDB because we are not using the tool for its intended purposes. However this tool is exactly what we need to create our contact form and it works very well.

This project requires Docker to be installed on your host machine.

**Step 1.** Install [NocoDB](https://github.com/nocodb/nocodb?ref=noted.lol) using Docker

```
version: '3.9'
services:
    nocodb:
        image: 'nocodb/nocodb:latest'
        ports:
            - '8044:8080'
        volumes:
            - '/docker/nocodb:/usr/app/data/'
```

Be sure to change the port or volume mount to your liking.

**Step 2.** Navigate to the host IP and port of the NocoDB install. For me it will be on port 8044. You can find your host IP by typing `ip addr` in the terminal.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/noco-db-self-hosted-signup-noted.lol-1.png)

**Step 3.** Register a new account then log in.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/noco-db-self-hosted-work-space-blank-noted.lol-1.png)

Once logged in, you will see a blank workspace. It will look quite lonely and desolate. Let's move on and create a project.

**Step 4.** Create a new project.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/noco-db-self-hosted-create-new-project-noted.lol.png)

Click "New project", give it a name and press "Create Database".

**Step 5.** Click "New table".

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/noco-db-self-hosted-new-table-noted.lol.png)

This will prompt you to give the table a name. Name it "Contact form table" then click "Create Table".

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/noco-db-self-hosted-new-table-name-noted.lol.png)

**Step 6.** Edit the first column name by clicking on the dropdown arrow. We will call it "Name" and save.

 ![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/noco-db-self-hosted-table-edit-and-add-noted.lol.png)

 ![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/noco-db-self-hosted-table-edit-name-noted.lol.png)

**Step 7.** Add another column and call it "E-Mail" with a column type "Email" then click save. This column type will allow the email to be clicked and responded to using your default email client. We will cover this more later.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/noco-db-self-hosted-table-add-email-noted.lol.png)

**Step 8.** Add a 3rd column called "Message" with a column type of "LongText". Click save column.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/noco-db-self-hosted-table-add-message-noted.lol.png)

Let's take a look at what our table looks like right now before we move forward. We have a Name, E-Mail and Message column.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-form-so-far-noted.lol.png)

### Adding the SMTP App in NocoDB

**Step 9.** Add the SMTP app. Before we create the form out of the table we just created, I want to go ahead and add the SMTP app. This can be tricky to find so follow along closely.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-form-account-settings-smtp-noted.lol.png)

In the lower left click on your email to open the menu then click on "Account Settings".

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-app-store-noted.lol.png)

Now click "App Store" and scroll down to SMTP towards the bottom.

Click install and enter your GMail SMTP information. You can use our detailed guide on [how to setup GMail SMTP](https://noted.lol/setup-gmail-smtp-sending-2023/).

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-app-store-smtp-add-details-noted.lol.png)

It's important that you leave Secure, Ignore TLS and Reject Unauthorized disabled. Now click save.

**Step 10.** Create a form. To create a form, navigate back to the main project and select the Contact Form Table we created.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-create-form-view-noted.lol.png)

Now, in the lower right click form to create a Form view of our table.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-create-form-view-name-noted.lol.png)

Call it "Contact Form" and click "Create View".

**Step 11.** Add options for when the form is submitted.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-form-view-options-noted.lol.png)

At the bottom, you should add a message people will see when they submit the form. Also, make sure you enable the "E-mail me at yourgmail@email.com".

To be clear, the form will email you at whatever email you registered with on your NocoDB instance.

**Step 12.** Create a public share of the form and test it.

Now that we have the form view created and the options set, we need to create a public share so we can access and use the form publicly.

In the upper right corner, click on 'Share".

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-form-public-share-noted.lol-1.png)

Make sure "Enable public viewing" is enabled. You can also choose a color if you wish. The theme colors don't apply to the theme itself sadly but only the web UI surrounding it. Now copy the link and open it in a browser tab to test the form.

 ![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-form-test-email-noted.lol.png)

 ![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-form-test-email-submitted-noted.lol.png)

Check your inbox to see if you got the email you sent using the form. If you did, the subject will be "NocoDB Form" and the email content will look like this.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-form-test-email-recieved-noted.lol.png)

**Step 13.** Confirm the submitted email was also logged in the table we created.

![Create a Contact Form using the Self-Hosted NocoDB and GMail SMTP](https://noted.lol/content/images/2023/09/nocodb-self-hosted-form-test-email-table-noted.lol.png)

Here we can see the email that was sent in the table view. This information can be exported and saved as well.

## Embed your public shared form link

You can use your public shared link by [attaching a domain name to it using Cloudflare](https://noted.lol/zero-trust-access-applications/).

Here is an example embed code you can use to embed the form on your website.

```
<iframe>
    class="nc-embed"
    src="https://nocodb.noted.lol/dashboard/#/nc/form/f42affl0-25d2-2f31-a90a-8d1996d8ck0l"
    frameborder="0"
    width="100%"
    height="800"
    style="background: transparent; border: 1px solid #ddd"
</iframe>
```

You will have to replace the src url with your link to use your form so don't forget to do that!

### Final Notes and Thoughts

While it may seem like this took a lot of time to get a working contact form, it really isn't as bad as it may seem. You can either create your own form at no cost or, go pay for a 3rd party service that may or may not be collecting all the emails coming through the form. You will never know.

There are a couple caveats of using NocoDB as a contact form. The subject of the emails and context cannot be modified. So the emails will always have a subject of NocoDB which for me, is quite fine and I'll always know where the emails came from. Now, there may be a way to change that by modifying NocoDB internal files then [building the Docker image yourself](https://noted.lol/build-and-publish-to-docker-hub/)... but that is a bit beyond the scope of this guide. 😆

Check out [NocoDb on Github](https://github.com/nocodb/nocodb?ref=noted.lol) and be sure to give the project a star!

*This article is cross posted from my publication* [Noted](https://noted.lol/nocodb-contact-form-gmail-smtp/).