Socket
Socket
Sign inDemoInstall

@lu-development/gmwrapper

Package Overview
Dependencies
Maintainers
8
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lu-development/gmwrapper

JS wrapper for the guerrilla mail API


Version published
Maintainers
8
Created
Source

gmWrapper

This module is a simple wrapper for the Guerillamail API.

Features

  • Programmatically access a disposable but persistent inbox
  • Set email username (different domains are not supported yet with this package)
  • Manage multiple email sessions as objects
  • Send, receive and delete emails
Please use this package responsibly, and checkout the project that inspired this wrapper!

Installing

Using npm:

$ npm install @lu-development/gmwrapper

Examples

Note: In order for the session to work, the establishSession() function must resolve. Because of the requests to the guerilla mail api, most functions return promises.

Checking an inbox using async/await:

const {gmSession} = require('@lu-development/gmwrapper')
async function () {
    let session = new gmSession()
    await session.establishSession()
    let inbox = await session.checkEmail()
}

Checking an inbox using promise chaining:

function () {
    let session = new gmSession()
    session.establishSession().then(() => {
        session.checkEmail().then((inbox)=> {
            console.log(inbox)
        })
    });
}

Setting a username:

async function () {
    let session = new gmSession()
    await session.establishSession()
    await session.setEmail('newusername')
}

//Optionally usernames can be set in the constructor
async function () {
    let session = new gmSession('username')
    await session.establishSession()
}

gmWrapper API

session.establishSession()

This function is required to start the session. Returns the session ID.

session.setEmail(emailUser)

Sets the username for the email. Returns the username.

session.checkEmail()

Checks the inbox for the session. Returns an array of email objects.

session.deleteEmail(email)

Deletes an email from the inbox, and requires the email object as an argument. Returns the response from the endpoint.

session.findEmailBySender(senderAddress[, timeout[, interval]])

Searches the inbox for an email by the sender address. Returns the email object.

session.findEmailBySubject(subject[, timeout[, interval]])

Searches the inbox for an email by the email subject. Returns the email object.

session.fetchEmail(emailID)

Queries for an email based on the email ID. Returns the email object.

session.getEmailAddr()

Returns the actual address for the inbox.

session.getAlias()

Returns an alias to conceal the address for the inbox.

session.getSid()

Returns session ID.

Sending Emails

The sending of emails is handled through a seperate object called the gmSender. It can be called like this:

sender.sendEmail(recipient, subject, body)

Sends an email from the session to the recipient.

const {gmSender} = require('@lu-development/gmwrapper')
async function () {
    let sender = new gmSender('myemail@gmail.com', 'password')
    await sender.sendEmail('otherTestUser@sharklasers.com', 'This is the subject', 'This is the body')
}

Keywords

FAQs

Package last updated on 07 Oct 2020

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