quave:email-postmark
quave:email-postmark
is a Meteor package that provides a plug-and-play integration with Postmark.
Why
It is designed to simplify the process of sending emails with Meteor.
We are using the email
package from Meteor.
We believe we are not reinventing the wheel in this package but what we are doing is like putting together the wheels in the vehicle :).
Installation
meteor add quave:email-postmark
Usage
Configuration
You just need to configure your authentication data in the settings if you just want to use Postmark as provider for Meteor emails.
1{ 2 "packages": { 3 "quave:email-postmark": { 4 "from": "noreply@yourdomain.com", 5 "apiToken": "tttttttt-1111-2222-3333-tttttttttttt" 6 } 7 } 8}
Or you need to set the from
here in the settings or you need to always call the email manually and inform the from in the props.
Code usage
If you want to use our code to send emails directly you can also call like below:
1import { sendEmail } from 'meteor/quave:email-postmark'; 2 3Meteor.methods({ 4 newEmail({ to, subject, content }) { 5 sendEmail({ 6 to, 7 subject, 8 content, 9 }) 10 .then(() => { 11 console.log(`Email sent to ${to}`); 12 }) 13 .catch(error => { 14 console.error(`Error sending email to ${to}`, error); 15 }); 16 } 17});
You can provide the from
as well in the sendEmail
function.
Limitations
Meteor email
package needs to be in the version 2.2 or above. This corresponds to Meteor version 2.4.
License
MIT