Send email from React
Mailik - The React email collector

Step by step guide on how to integrate Mailik within a React component.

Mailik

First do a basic set up on your Mailik account:

Account setup

  1. Navigate to Mailik and create a free account on mailik. T
  2. Create a project
  3. Copy the public key to clipboard

Install mailik

Then install mailik in your repository using node:

$ npm i @mailik/sdk

Create a form on a page

Now you need to set up a form which will receive emails on one of your pages (e.g on the index page)

import Mailik from "@mailik/sdk";
import React, { useState } from "react";

const MainPage = () => {
  const [email, setEmail] = useState("");
  const [message, setMessage] = useState("");
  // Sending function
  const send = async () => {
    if (email && message) {
      const mailikResult = await Mailik("YOUR-PUBLIC-KEY-HERE").send({
        body: message,
        replyTo: email,
        subject: "Form from my Website",
      });
    }
  };

  return (
    <>
      <input value={email} onChange={(e) => setEmail(e.target.value)} />
      <textarea value={message} onChange={(e) => setMessage(e.target.value)} />
      <button>Send</button>
    </>
  );
};

After setting this up it will send the emails to the owner of the project that you have set up in Mailik panel.

Never miss any potential leads again
use the React email collector