---
updatedAt: 2025-07-15T08:47:16.000Z
agentTools:
  projectIndex: https://docs.appery.io/llms.txt
---

# Email with SendGrid Sample jQM App

Sending email from a jQuery Mobile app with SendGrid.

> 🚧 Important Note!
>
> The option of creating new apps with the[**jQuery Mobile**](https://docs.appery.io/docs/appbuilder-jqm-overview) framework was removed but we still support the projects that were created with it earlier.

​This example uses SendGrid API to send emails from an app.

This sample app uses and demonstrates:

* jQuery Mobile.
* Server Code.
* Invoking an external REST API.

# App (UI)

To get the app UI:

1. Create a new jQuery Mobile app based on the **Blank** template.
2. Inside the [App Builder](https://docs.appery.io/docs/apperyio-visual-builder), select **CREATE NEW > From plugin**. Under **Appery.io Examples**, select **Email with SendGrid**.
3. Click the **Import selected plugin** button.
4. Select **sendgrid** as the starter page and click **Apply settings**.

# Backend

To get the app backend:

1. Go to the **[Server Code](https://appery.io/servercode/)** page.
2. Go to the **Plugins** page.
3. Import the **SendGridEmail** plug-in.

## SendGrid Account

You also need to create a [SendGrid account](http://sendgrid.com) to get an API key to send emails. After you sign up for an account, get the API key:

1. From the main dashboard page, expand **Settings** (bottom left).
2. Click **API Keys**.
3. Then, click **Create API Key**:

![](https://files.readme.io/90fe505-Screenshot_31.png "Screenshot_31.png")

4. Give the key a name and then check **Full Access** for **API Key Permissions** selection:

![](https://files.readme.io/7e9f0a1-Screenshot_32.png "Screenshot_32.png")

5. Click **Create & View**. The generated key will be shown on the next page. You should copy and save this key.

> 👍 Important!
>
> Note that before you can send emails using the SendGrid API, you need to make sure the domain you're sending from is [authenticated](https://app.sendgrid.com/settings/sender_auth) under **Settings > Sender Authentication**:

![](https://files.readme.io/17e7a1e-08-11-2021_16-27-30.jpg "08-11-2021 16-27-30.jpg")

## Configuring the Server Code Script

Now, you need to configure the script.

1. Open the Server Code script you have just imported:

<Image align="center" width="smart" src="https://files.readme.io/dc24928-Screenshot_18.png" />

2. In line #8, indicate the  `Your Name <email>` parameter of the SendGrid sender account. Note that the sender domain must be [authenticated](https://app.sendgrid.com/settings/sender_auth).
3. Find line #10, find `api_key` and replace it with the key you created above.

That's all you need to do to configure this script.

## Testing the Script

It's a good idea to test the script and the **SendGrid API** to make sure it works.

1. Switch to the **Script parameters** tab.
2. Create some sample **Request body**, for example:

```typescript
{"to": "test@example.com", "subject":"Appery.io test", "body":"Hello World!"}
```

> 📘 Note!
>
> Any ***html*** markup can be used for **body** parameter.

3. Switch to the **Run** tab and click the **Save and run** button.

# Connecting the App with the Backend

The last step is to connect the app with the backend.

1. Inside the App Builder, open **Services > SendGridEmail\_service**.
2. In the **Settings** tab, you will see ***\{servercode}*** in the URL. To replace the value with the script ID, in the **Server Code** script, switch to the **API information** tab. There, you will see the script ID in the URL you need to use.
3. Save all the changes.

# App Testing

You are now ready to test the app. Click the **TEST** button in the [App Builder](https://docs.appery.io/docs/apperyio-visual-builder) to launch the app in the browser.

# More Help Resources

More help resources on our [YouTube](http://youtube.com/apperyio) channel:

* [Using SendGrid Mail API to Send In-App Emails](https://youtu.be/UCg7yHxjX2M)