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

ibmcatalyst-smtpmailer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ibmcatalyst-smtpmailer

a nodejs module that send an email using SMTP protocol

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Overview

This module provides a utility class and methods to send an email using smtp protocol.

Prerequisites

Note: On Windows you should run all commands from Git Bash window

  1. Install Git client. Note: When installing, please select the option to use Git from the Windows command line Note: It is very important that you add an SSH Key to your Gitlab profile, or you will not be able to securely download projects.
  2. Generate an SSH key and then upload the key here. Note: It is important that you use Git Bash if you are using Windows to run the commands listed in the Generating SSH Keys instructions.
  3. Install node.js

Install

Run the following command to install:

$ npm install ibmcatalyst-smtpmailer

Methods

var mailer = require("ibmcatalyst-smtpmailer");  
var smtpReq = mailer(params, callback);
  • Send an email with configuration parameters params.

  • An optional callback callback(err, smtpReq) will fire once the initial handshake is complete.

  • The smtpReq object is a stream.

    • Use smtpReq.setHeader(key, value) to set the 'content-type', 'subject', and such things relevant to emails.

    • Use smtpReq.removeHeader(key) to remove a header.

    • Use smtpReq.write(data) to write a string or a buffer to the message body after the headers.

    • Use smtpReq.end(data) to transmit data.

Example

var smtpmailer = require("ibmcatalyst-smtpmailer");

function sendEmail(options){
  var mail = smtpmailer({
    host : options.host,
    port : options.port,
    from : options.from,
    to : options.to
  });
  mail.setHeader("content-type", "text/plain");
  mail.setHeader("subject", options.subject);
  mail.end(options.body);
}

var params = {
  host: "relay.us.ibm.com",
  port: 25,
  from: "enabled@us.ibm.com",
  to: "johndoe@us.ibm.com",
  subject: "Greeting message",
  body: "Hi buddy, how are you doing?"
};
sendEmail(params);

Troubleshooting

  1. If you are repeatedly prompted for a password, your SSH agent may not be running or configured correctly. This is usually an issue on Windows. Do the following (from Git Bash on Windows) to ensure that the agent is started and has your identity added to it. You should see the text you uploaded to your SSH Keys section in Gitlab from the second command.

    $ eval "$(ssh-agent -s)"
    $ ssh-add -L
    

If not, you need to do issue the following commands. Keep Git Bash open on Windows to avoid further password prompts.

```c
$ ssh-add ~/.ssh/id_rsa
$ ssh-add -L

FAQs

Package last updated on 09 Nov 2015

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