![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
parse-server-mailgun
Advanced tools
Allows your Parse Server app to send template-based emails through Mailgun. Just add your template files (plain text and html) to the email adapter's configuration.
npm install --save parse-server-mailgun
As is the case with the default Mailgun adapter that comes with the Parse Server, you need to set a fromAddres, and the domain and apiKey provided by Mailgun. In addition, you also need to configure the templates you want to use. You must provide at least a plain-text version for each template. The html versions are optional.
const resolve = require('path').resolve;
// Note that the paths to the templates are absolute.
var server = ParseServer({
...otherOptions,
// Enable email verification
verifyUserEmails: true,
emailAdapter: {
module: 'parse-server-mailgun',
options: {
// The address that your emails come from
fromAddress: 'YourApp <noreply@yourapp.com>',
// Your domain from mailgun.com
domain: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
// The template section
templates: {
passwordResetEmail: {
subject: 'Reset your password',
pathPlainText: resolve(__dirname, 'path/to/templates/password_reset_email.txt'),
pathHtml: resolve(__dirname, 'path/to/templates/password_reset_email.html'),
callback: (user) => { return { firstName: user.get('firstName') }}
// Now you can use {{firstName}} in your templates
},
verificationEmail: {
subject: 'Confirm your account',
pathPlainText: resolve(__dirname, 'path/to/templates/verification_email.txt'),
pathHtml: resolve(__dirname, 'path/to/templates/verification_email.html'),
callback: (user) => { return { firstName: user.get('firstName') }}
// Now you can use {{firstName}} in your templates
},
customEmailAlert: {
subject: 'Urgent notification!',
pathPlainText: resolve(__dirname, 'path/to/templates/custom_alert.txt'),
pathHtml: resolve(__dirname, 'path/to/templates/custom_alert.html'),
}
}
}
}
});
The Parse Server uses the MailgunAdapter for only two use cases: password reset and email address verification. With a few lines of code, it's also possible to use the MailgunAdapter directly, so that you can send any other template-based email, provided it has been configured as shown in the example configuration above.
// Get access to Parse Server's cache
const { AppCache } = require('parse-server/lib/cache');
// Get a reference to the MailgunAdapter
// NOTE: It's best to do this inside the Parse.Cloud.define(...) method body and not at the top of your file with your other imports. This gives Parse Server time to boot, setup cloud code and the email adapter.
const MailgunAdapter = AppCache.get('yourAppId')['userController']['adapter'];
// Invoke the send method with an options object
MailgunAdapter.send({
templateName: 'customEmailAlert',
// Optional override of your configuration's subject
subject: 'Important: action required',
// Optional override of the adapter's fromAddress
fromAddress: 'Alerts <noreply@yourapp.com>',
recipient: 'user@email.com',
variables: { alert: 'New posts' } // {{alert}} will be compiled to 'New posts'
});
The dependency on cheerio is removed. From now on, use Mustache-style variable syntax, e.g. {{variable}}
, in your templates.
If you're upgrading from 1.0.2, be sure to update your templates with the new syntax style!
In the test directory, there are a few examples to get you started.
For password reset and address verification messages, you can use the following template variables by default:
{{link}}
- the reset or verification link provided by the Parse Server{{appName}}
- as is defined in your Parse Server configuration object{{username}}
- the Parse.User object's username property{{email}}
- the Parse.User object's email propertyAdditional variables can be introduced by adding a callback. An example is shown in the configuration above. The relevant Parse.User object is passed as an argument. The return value must be a plain object where the property names exactly match their template counterparts. Note: the callback options only applies to the password reset and email address verification use cases.
For any other use case, you use the MailgunAdapter
directly and pass any variable you need to the send
method as explained in the code sample above.
FAQs
Mailgun adapter for Parse Server apps
The npm package parse-server-mailgun receives a total of 755 weekly downloads. As such, parse-server-mailgun popularity was classified as not popular.
We found that parse-server-mailgun demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.