Using SendGrid Plugin for Bulk Mailing

This document shows how to define bulk mailing using the SendGridEmail plugin

In this document, we will demonstrate how you can set up bulk mailing to all your Database users by using the Server Code SendGridEmail plugin.


SendGrid Account

Before you you can send emails with the SendGridEmail plugin, you will need to create a SendGrid account to get an API key.
Please check out this section to learn more.

  1. First of all, create an database and name it DbWithUsers.
  2. Open the Users predefined collection and add several email addresses to it by clicking the +Row button and providing the needed data:
  1. Go to the Server Code > Plugins tab and import the SendGridEmail plugin:


Note that with this plugin, several related snippets have been added, so we will need to edit this script to customize it.

  1. Click Create script to create a new script, name it to BulkMailingWithSendGrid and clear the default code.
  2. Then filter the snippets list by SendGridEmail and click the corresponding link to insert the sendEmailBulkMailing snippet:
  1. In the code editor, locate the from and apiKey entries, replace their variables with your own SendGrid parameters, and save the script:
  1. Under the script Settings tab, select your database with the users' list (in our case, it's DbWithUsers):
  1. That's all and now, you can set any subject and body and send a bulk email to your app users.


Scheduling Bulk Email Sending

If needed, you can additionally schedule an automatic job that will send all script emails at a specific time.
To do it, switch to the Jobs tab and specify the needed data for your BulkMailingWithSendGrid script: