Sending Emails with SendGrid

What You'll Need

Backbench account - Sign Up, the personal account will always remain free to use.

A SendGrid account, sign up for free to send up to 40,000 emails for the first 30 days.

Prerequisites for the app

  1. Sign In to Backbench account.

  2. Select +, in the upper right corner to create a Bench. For example, say "bench_one" and select CREATE or hit Enter.

Frontend

  1. Select +, in the upper right corner of file manager to create a html file. For example, say "index.html" and select CREATE or hit Enter.

  2. Copy and paste the code module from below.

  3. Select save.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>mail service</title>
</head>
<body>
<div id="contact">
    <h1>Send an email</h1>
    <form action="/sg" method="post">
        <fieldset>
            <label for="from">From:</label>
            <input type="text" id="from" name="from" placeholder="From email_id" />

            <label for="Toemail">Email:</label>
            <input type="email" id="email" name="email" placeholder="Enter your email address" />

            <label for="subject">subject:</label>
            <input type="subject" id="subject" name="subject" placeholder="subject" />

            <label for="message">Message:</label>
            <textarea id="message" placeholder="Message" name="message"></textarea>

            <input type="submit" value="Send message" />
        </fieldset>
    </form>
</div>
</body>
</html>

Adding Dependencies

For nodejs only.

  1. Create a module name package.json and paste following code.

Backend

  1. Select +, in the upper right corner to create a Module. For example, say "Send_email.js" and select CREATE or hit Enter.

  2. Copy and paste the code module from below.

  3. Replace an API key from SendGrid setting section (create a new api key using create button).

  4. Select save.

Last updated