New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

comailer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comailer

co yield your nodemailer!

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

Comailer

A simple CO wrapper around Nodemailer

yield Nodemailer from co or koa!

CoffeeScript (is optional, see javascript below)

    'use strict'
    co = require 'co'

    comailer = require 'comailer'
    transporter = comailer.createTransport
      service: 'gmail'
      auth:
        user: 'sender@gmail.com'
        pass: 'password'

    co ->
      # yielding can throw errors you could try/catch or bail out
      try

        result = yield transporter.sendMail
          from: 'sender@address'
          to: 'receiver@address'
          subject: 'hello'
          text: 'hello world!'

        console.log result
      catch error
        console.error error.stack

    # if you need to still need to call without yielding:
    thunkOfSendMail = transporter.sendMail
      from: 'sender@address'
      to: 'receiver@address'
      subject: 'hello'
      text: 'hello world!'
    #...
    thunkOfSendMail (error, result) ->
      if error
        console.error error.stack
      else
        console.log result

Javascript

    'use strict'
    var co = require('co');

    var comailer = require('comailer');
    var transporter = comailer.createTransport({
      service: 'gmail',
      auth: {
        user: 'sender@gmail.com',
        pass: 'password'
      }
    });

    co(function* () {
      // yielding can throw errors you could try/catch or bail out
      try {

        var result = yield transporter.sendMail({
          from: 'sender@address',
          to: 'receiver@address',
          subject: 'hello',
          text: 'hello world!'
        });

        console.log(result);
      } catch (error) {
        console.error(error.stack);
      }
    });

    // if you need to still need to call without yielding using the returned thunk directly:
    thunkOfSendMail = transporter.sendMail({
      from: 'sender@address',
      to: 'receiver@address',
      subject: 'hello',
      text: 'hello world!'
    });
    //...
    thunkOfSendMail(function (error, result) {
      if (error) {
        console.error(error.stack);
      } else {
        console.log(result);
      }
    });

Keywords

FAQs

Package last updated on 26 May 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