1.0.13 • Published 9 months ago

nodemailer-zeptomail-transport v1.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

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: 'sender@example.com',
      to: 'recipient@receiver.com',
      replyTo: 'reply-to@example.com',
      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: 'sender@example.com',
      to: 'recipient@receiver.com',
      replyTo: 'reply-to@example.com',
      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

License

MIT

1.0.13

9 months ago

1.0.12

9 months ago

1.0.10

10 months ago

1.0.9

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.2

10 months ago