Functional Contact Form using HTML, TailwindCSS, SMTPJS and Elastic Email
#html
#css
#tailwindcss
#smtpjs
#elastic-email
#javascript
#projects
Introduction
Building a sleek and efficient contact form without backend code is little confusing. So lets build the minimal form as shown above using HTML, TailwindCSS, SMTPJS, and Elastic Email – all without any complex backend code. Moreover, client-side form validation is also implemented.
Necessary Setup in Elastic Email
- Firstly visit the Elastic Email website by Clicking me✈️
- There you can see the
Try for Free
from where you will be redirected to the product selecting page. - Choose the
Email API
by clicking theTry for Free
of Email API. - After that you will be redirected to the
Signup
page. And you can simply signup using you Gmail easily. - And once, signup is properly carried out, then you will be redirected to your Elastic Email dashboard
- Now you need to create your STMP credentials. For that simply click on the settings, and there you can see the SMTP credentials creating section as below.
- After that you will reach to a field which asks for the
username
. Simply put the email through which you are logged in (Example - youremail@gmail.com). - After that a popup will appear which consists of Username, password, Server and the Post. (Note the username and the password somewhere as you need it in the SMTPJS and close the popup.)
- Now you need to verify the existing email address and the domains. So as similar to step 6. Click on the settings and there you can see the Domains section.
- After that you will see the
Domain verification
as well as theEmail Verification
from where you need to verify you domain if you have domain and if not you need to verify the email compulsoryly. - Once the verification is done, we can jump to the SMTPJS for further steps.
Necessary Setup in SMTPJS
- Firstly visit the SMTPJS website by Clicking me✈️
- On scrolling you will react to the security section from where you can encrypt your SMTP credentials. Simple click on it.
- On clicking
Encrypt your SMTP Credentials
, a popup will appear as below where you need to fillSTMP Username
and theSMTP Password
. Put the username and password you obtained inStep-08
in Elastic Email part. - After filling the form, on clicking the
Generate security token
a token is created. Again save this token somewhere, we will use it in our form. - Finally the Elastic email and the SMTPJS part is done. Now you can download the code from below link.
Source Code
Get the code. If you like the code, consider following and giving the repo a star 🌟
Final Changes on the code
- If you open the JavaScript code file
./script.js
, you can see theSecureToken
, simply add your secure token and change theto
andfrom
value with your email. Finally everything is completed. Try testing 😄
Final Message
If you are having any hard times following the above mentioned steps. Feel free to connect with me in instagram and to drop you queries 👻