f7labs:email-resend
is a package that simplifies the process of sending emails using Meteor. It provides a plug-and-play integration with Resend, leveraging the powerful email package from Meteor.
To install f7labs:email-resend
, simply execute the following command:
meteor add f7labs:email-resend
Create a Resend account, create an API Key and verify your domain.
To get started quickly with using Resend as the email provider for Meteor, you only need to configure your API Key in your settings. Modify your settings file as follows:
{
"packages": {
"f7labs:email-resend": {
"from": "[email protected]",
"apiKey": "re_aAAaAAAA_0a0AaAAaAaAaaaaaAa0AaAAA"
}
}
}
Alternatively, if you prefer to set the from
field dynamically, you can do so by either configuring it in the settings or by passing it as a prop when calling the email manually.
Automatically used when calling methods from the Email
and Accounts Password
packages. For example when calling Accounts functions as Accounts.sendVerificationEmail()
, Accounts.forgotPassword()
, Accounts.sendResetPasswordEmail()
, and so on.
You can also use this package to send emails directly. Here's an example of how to do it:
import { Meteor } from 'meteor/meteor';
import { sendEmail } from 'meteor/f7labs:email-resend';
Meteor.methods({
sendMyRandomEmail({ to, subject, content }) {
sendEmail({
to,
subject,
content,
})
.then(() => {
console.log(`Email sent to ${to}`);
})
.catch(error => {
console.error(`Error sending email to ${to}`, error);
});
}
});
You can optionally provide the from
field in the sendEmail
function if you haven't set it in the package settings.
Please note that the Meteor email
package needs to be in version 2.2 or above, which corresponds to Meteor version 2.4
.
This project is licensed under the MIT license.