@storecraft/mailer-providers-http
v1.0.6
Published
Official Serverless Friendly e-mail adapters for storecraft
Downloads
112
Maintainers
Readme
storecraft
Official serverless http email providers
Supports wellknown http-based serverless
friendly email
providers,
TODO: confirm tests
npm i @storecraft/mailer-providers-http
Howto
Sendgrid
import { SendGrid } from '@storecraft/mailer-providers-http/sendgrid';
const mailer = new SendGrid(
{
apikey: process.env.SEND_GRID_SECRET
}
);
let { success, native_response } = await mailer.email({
from: {name: 'bob 👻', address: process.env.FROM_EMAIL }, // sender address
to: [ { address: process.env.TO_EMAIL } ], // list of receivers
subject: 'subject test', // Subject line
text: 'plain text test', // plain text body
html: '<p>html test</p>', // html body
});
Resend
import { Resend } from '@storecraft/mailer-providers-http/resend';
const mailer = new Resend(
{
apikey: process.env.RESEND_API_KEY
}
);
let { success, native_response } = await mailer.email({
from: {name: 'bob 👻', address: process.env.FROM_EMAIL }, // sender address
to: [ { address: process.env.TO_EMAIL } ], // list of receivers
subject: 'subject test', // Subject line
text: 'plain text test', // plain text body
html: '<p>html test</p>', // html body
});
Mailchimp
import { MailChimp } from '@storecraft/mailer-providers-http/mailchimp';
const mailer = new MailChimp(
{
apikey: process.env.MAILCHIMP_API_KEY
}
);
let { success, native_response } = await mailer.email({
from: {name: 'bob 👻', address: process.env.FROM_EMAIL }, // sender address
to: [ { address: process.env.TO_EMAIL } ], // list of receivers
subject: 'subject test', // Subject line
text: 'plain text test', // plain text body
html: '<p>html test</p>', // html body
});
Mailgun
import { Mailgun } from '@storecraft/mailer-providers-http/mailgun';
const mailer = new Mailgun(
{
apikey: process.env.MAILGUN_API_KEY
}
);
let { success, native_response } = await mailer.email(
{
from: {name: 'bob 👻', address: process.env.FROM_EMAIL }, // sender address
to: [ { address: process.env.TO_EMAIL } ], // list of receivers
subject: 'subject test', // Subject line
text: 'plain text test', // plain text body
html: '<p>html test</p>', // html body
}
);
Author: Tomer Shalev ([email protected])