nodemailer-zeptomail-transport
v1.0.13
Published
Small transport plugin for Zeptomail API and Nodemailer v4+.
Downloads
188
Maintainers
Readme
nodemailer-zeptomail-transport
Intro
A custom transport plugin that allows to send email using Nodemailer via Zeptomail from ZOHO
Purpose
I was looking for nodemailer transport for Zeptomail but couldn't find one. So I decided to create one. This is a tiny plugin for the new Zeptomail API and Nodemailer v4+. Really tiny and optimized plugin written in Typescript
Support the project
Please support me by clicking the star button -- It helps the engine go on
Documentation
Common fields in Nodemailer are supported...even replyTo
Quick start
Start by installing via npm
$ npm i nodemailer-zeptomail-transport
Be sure to get your API Key. Click here to see how
Examples
Send a simple mail
'use strict';
const nodemailer = require('nodemailer');
const { ZeptomailTransport } = require('nodemailer-zeptomail-transport');
const zeptomail = new ZeptomailTransport({
apiKey: 'test-2453644432757-key'
region: 'eu', // for EU customers only
})
let transport = nodemailer.createTransport(zeptomail);
transport.sendMail({
from: '[email protected]',
to: '[email protected]',
replyTo: '[email protected]',
subject: 'Zeptomail Transport',
text: 'Some text to send'
}).then((info) => {
console.log('SUCCESS');
}).catch((error) => {
console.log('Something is wrong');
});
Send mail with attachments
'use strict';
const nodemailer = require('nodemailer');
const { ZeptomailTransport } = require('nodemailer-zeptomail-transport');
const zeptomail = new ZeptomailTransport({
apiKey: 'test-2453644432757-key'
region: 'eu', // for EU customers only
})
const transport = nodemailer.createTransport(zeptomail);
transport.sendMail({
from: '[email protected]',
to: '[email protected]',
replyTo: '[email protected]',
subject: 'Zeptomail Transport',
html: '<!DOCTYPE html><html><body><img src="cid:attachment" alt="attachment"></body></html>',
attachments: [{
content: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAA...', // base64 content
cid: 'attachment',
contentType: 'image/jpeg',
filename: 'attachment.jpg',
encoding: 'base64'
}]
}).then((info) => {
console.log('SUCCESS');
}).catch((error) => {
console.log('Something is wrong');
});
Thanks to leo for the PR to enable Region support