How to send emails to a custom SMTP server using emailJs
EmailJs makes the entire process of sending messages to your email service(Gmail, Yahoo, etc.) or transactional service(Mailgun, Mailjet, Sendgrid, etc.) a breeze. In my previous post, “How to send emails using React through EmailJs”. I touched on how to send emails to personal services, specifically, Gmail. In this blog post, I will talk about how to send emails to a custom SMTP server using EmailJs.
In case you’re wondering what SMTP is, SMTP(Simple Messaging Transfer Protocol) is a communication protocol for electronic mail transmission (Wikipedia). Mail servers and other mail transfer agents use SMTP to send and receive mail messages.
Recently, I worked on a project built with React and hosted on HostGator. After creating a new email under the registered domain(email@example.com), I needed a way to send messages to the newly created email account via a contact form I built with React.
I was happy when I found out EmailJs supports SMTP-server because of their easy to understand documentation and API integration. In no time, I was able to complete the task of connecting a custom SMTP-server using EmailJs to a contact form. Hence, I decided to write a tutorial on the topic.
Below are the simple steps you will need to follow to connect your website form to a custom SMTP server and send emails using EmailJs service.
Step 1: Adding an Email Service(SMTP server)
Assuming you have an account and have signed in to your dashboard. Click on the email services link on the left sidebar. You should see a button with the inscription Add Email Service. A pop-up modal will open, select the SMTP server as the preferred email service to add.