# Email Notification

**URL:** <https://community.parseplatform.org/t/email-notification/1146>\
**Category:** Parse Server 📡\
**Created:** [December 21, 2020, 3:29pm UTC](https://community.parseplatform.org/t/email-notification/1146 "2020-12-21T15:29:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MeIr](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/m/2acd7d/32.png) [@MeIr](https://community.parseplatform.org/u/MeIr)\
**Post date:** [December 21, 2020, 3:29pm UTC](https://community.parseplatform.org/t/email-notification/1146/1 "2020-12-21T15:29:33Z")

</div>

Hello everyone, a quick question: does Parse Server provides scheduled email notification? For example: user can set email notification - like a reminder - where Parse Server will email user on a selected (by the user) date with user input message, ex: “please login into an app - there is something that needs your attention.”

Thanks.

---

<div class="post-metadata">

**Author:** ![dblythy](https://community.parseplatform.org/user_avatar/community.parseplatform.org/dblythy/32/231_2.png) [@dblythy](https://community.parseplatform.org/u/dblythy)\
**Post date:** [December 21, 2020, 4:50pm UTC](https://community.parseplatform.org/t/email-notification/1146/2 "2020-12-21T16:50:52Z")

</div>

Which emailAdapter / mail provider are you using?

You will probably need cron scheduler, and query something like:

```auto
const schedule = require("node-schedule");
const rule = new schedule.RecurrenceRule();
rule.hour = 17;
schedule.scheduleJob(rule, async () => {
  const query = new Parse.Query("Actions");
  query.equalTo("complete", false);

  const yesterday = new Date();
  yesterday.setDate(yesterday.getDate() - 1);

  const lastWeek = new Date();
  lastWeek.setDate(lastWeek.getDate() - 7);

  const userQuery = new Parse.Query(Parse.User);
  userQuery.lessThan("lastOpened", yesterday);
  userQuery.lessThan("lastEmailed", lastWeek);

  query.matchesQuery("user", userQuery);
  query.include("user.firstName", "user.email");
  query.exists("user.firstName", "user.email");

  const actionsToComplete = await query.find({ useMasterKey: true });

  const mailgun = require("mailgun-js")({ apiKey: api_key, domain: domain });

  const usersToSave = [];
  for (const action of actionsToComplete) {
    const user = action.get("user");
    const data = {
      from: "Excited User <me@samples.mailgun.org>",
      to: user.get("email"),
      subject: "You have tasks to complete",
      text: `Hi ${user.get("firstName")}, you have tasks to complete.}`,
    };
    mailgun.messages().send(data);
    user.set("lastEmailed", new Date());
    usersToSave.push(user);
  }
  await Parse.Object.saveAll(usersToSave, { useMasterKey: true });
});

```

Obviously this depends on your data structure or mail provider.

---

<div class="post-metadata">

**Author:** ![MeIr](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/m/2acd7d/32.png) [@MeIr](https://community.parseplatform.org/u/MeIr)\
**Post date:** [December 21, 2020, 8:48pm UTC](https://community.parseplatform.org/t/email-notification/1146/3 "2020-12-21T20:48:29Z")

</div>

Thanks, let me take a look at adapters first.

---

<div class="post-metadata">

**Author:** ![dblythy](https://community.parseplatform.org/user_avatar/community.parseplatform.org/dblythy/32/231_2.png) [@dblythy](https://community.parseplatform.org/u/dblythy)\
**Post date:** [January 2, 2021, 1:48am UTC](https://community.parseplatform.org/t/email-notification/1146/4 "2021-01-02T01:48:31Z")

</div>

On the master branch, you can now send email via:

```auto
Parse.Cloud.sendEmail({
      from: "Excited User <me@samples.mailgun.org>",
      to: user.get("email"),
      subject: "You have tasks to complete",
      text: `Hi ${user.get("firstName")}, you have tasks to complete.`,
})

```

---

<div class="post-metadata">

**Author:** ![MeIr](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/m/2acd7d/32.png) [@MeIr](https://community.parseplatform.org/u/MeIr)\
**Post date:** [January 3, 2021, 12:02am UTC](https://community.parseplatform.org/t/email-notification/1146/5 "2021-01-03T00:02:52Z")

</div>

Sorry for ignorant question, but who provides email service for the parse instance?

---

<div class="post-metadata">

**Author:** ![uzaysan](https://community.parseplatform.org/user_avatar/community.parseplatform.org/uzaysan/32/59_2.png) [@uzaysan](https://community.parseplatform.org/u/uzaysan)\
**Post date:** [January 3, 2021, 6:34am UTC](https://community.parseplatform.org/t/email-notification/1146/6 "2021-01-03T06:34:07Z")

</div>

You set your own email provider.

---

<div class="post-metadata">

**Author:** ![dblythy](https://community.parseplatform.org/user_avatar/community.parseplatform.org/dblythy/32/231_2.png) [@dblythy](https://community.parseplatform.org/u/dblythy)\
**Post date:** [January 3, 2021, 7:14am UTC](https://community.parseplatform.org/t/email-notification/1146/7 "2021-01-03T07:14:04Z")

</div>

That’s ok, you’re welcome to ask questions.

There is a little bit of information around mail adapters on the [Parse Server GitHub](https://github.com/parse-community/parse-server#email-verification-and-password-reset). The email provider you choose is up to you (price, availability, etc).

---

<div class="post-metadata">

**Author:** ![FELS-Zak](https://community.parseplatform.org/user_avatar/community.parseplatform.org/fels-zak/32/423_2.png) [@FELS-Zak](https://community.parseplatform.org/u/FELS-Zak)\
**Post date:** [January 21, 2025, 10:27pm UTC](https://community.parseplatform.org/t/email-notification/1146/8 "2025-01-21T22:27:53Z")

</div>

how do you set a TEMPLATE and variables for that eg: {{ greeting }} and assign them to the email ?
