Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

amqp-producer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amqp-producer

AMQP Producer wrapper for emails

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

AMQP Producer wrapper for emails

Package is able to connect to AMQP server and send messages to queue. Messages will be send as encoded JSON. The main approach is to send encoded JSON as message to queue in which it should be decoded and send an email based on given JSON

Usage

const {MailerProducerService} = require('amqp-producer');

// Create mailerProducer instance
const mailerProducerConfig = [
    'amqp',
    'localhost',
    5672,
    'guest',
    'guest',
    '/',
    'email_queue'
];
const mailerProducer = new MailerProducerService(...mailerProducerConfig);


const start = async () => {
    // Start mailProducer
    await mailerProducer.start();
    
    // Send message to queue 
    const emailConfig = [
        'user@example.com',
        ['admin1@example.com', 'admin2@example.com'],
        'My Subject',
        'My Text'
    ];
    mailerProducer.sendEmailMsg(...emailConfig);
    
    // Stop mailProducer 
    mailerProducer.stop();
};

start();

API

MailerProducerService

An implementation of AMQP Producer

Kind: global class

new MailerProducerService(protocol, hostname, port, username, password, vhost, queue)

ParamType
protocolstring
hostnamestring
portnumber
usernamestring
passwordstring
vhoststring
queuestring

mailerProducerService.start() ⇒ Promise.<void>

Setup connection, channel and queue

Kind: instance method of MailerProducerService

mailerProducerService.stop()

Close connection

Kind: instance method of MailerProducerService

mailerProducerService.sendEmailMsg(to, cc, subject, text)

Send email msg to queue

Kind: instance method of MailerProducerService

ParamType
tostring
ccArray.<string>
subjectstring
textstring

FAQs

Package last updated on 24 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc