Sending Email

Sending emails from Moralis Server.

Sever Setup

Moralis supports sending emails to users. Click the "View Details" button on your sever instance then the "Email Configuration" tab. You will need to sign up for a SendGrid account and provide the following:

  • API key

  • From Email. This will appear as the "from" address on emails received by users.

Sending an email must done on the server side via Cloud Code as it requires the MasterKey. This is to help prevent the domain from being blacklisted for spam by bad actors.

Sending

Sending an email must done on the server side via Cloud Code as it requires the MasterKey. This is to help prevent the domain from being blacklisted for spam by bad actors.

// in Cloud Code
Moralis.Cloud.define("sendEmailToUser", function (request) {
Moralis.Cloud.sendEmail({
to: request.user.get("email"),
subject: "Fundamentals",
html: "Pampamentally it does make sense https://youtu.be/xXrkgWDcd7c"
});
});